Deserialisation :s

master
Baptiste ARNAUD 5 years ago
parent 9a0d745e6f
commit f0d8982976

Binary file not shown.

@ -3,4 +3,6 @@
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" /> <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<application android:label="TheGameExtreme.Android" android:icon="@drawable/Apple"></application> <application android:label="TheGameExtreme.Android" android:icon="@drawable/Apple"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
</manifest> </manifest>

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace TheGameExtreme.IO
{
class IOOptions
{
string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "file.xml");
public void SaveOptionParameter()
{
/*if (!File.Exists(path))
{
XmlSerializer ser = new XmlSerializer(typeof(bool));
using (StreamWriter sw = File.CreateText(path))
{
sw.WriteLine(swTheme.IsToggled);
}
}*/
}
}
}

@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Application xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014/forms/design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="TheGameExtreme.App"> <Application xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014/forms/design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="TheGameExtreme.App">
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>
<Color x:Key="BlackColor">black</Color> <Color x:Key="BlackColor">black</Color>
<Color x:Key="WhiteColor">white</Color> <Color x:Key="WhiteColor">white</Color>
<Color x:Key="SkyBlueColor">SkyBlue</Color> <Color x:Key="SkyBlueColor">SkyBlue</Color>
</ResourceDictionary>
</ResourceDictionary>
</Application.Resources> </Application.Resources>
</Application> </Application>

@ -16,7 +16,7 @@ namespace TheGameExtreme
} }
protected override void OnStart() protected override void OnStart()
{ {
// Handle when your app starts // Handle when your app starts
} }

@ -1,7 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using Xamarin.Forms; using Xamarin.Forms;
using System.Diagnostics;
namespace TheGameExtreme.view namespace TheGameExtreme.view
{ {
@ -12,6 +14,12 @@ namespace TheGameExtreme.view
{ {
InitializeComponent(); InitializeComponent();
NavigationPage.SetHasNavigationBar(this, false); NavigationPage.SetHasNavigationBar(this, false);
/*string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "file.xml");
XmlSerializer xs = new XmlSerializer(typeof(bool));
FileStream fs = new FileStream(path, FileMode.Open);
bool test = (bool)xs.Deserialize(fs);
Debug.WriteLine(test);*/
} }
private async void OpenGame(object sender, EventArgs args) private async void OpenGame(object sender, EventArgs args)
{ {

@ -1,6 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization.Json;
using System.Text; using System.Text;
using System.Xml; using System.Xml;
using System.Xml.Serialization; using System.Xml.Serialization;
@ -43,10 +46,7 @@ namespace TheGameExtreme.view
CBFr.IsChecked = true; CBFr.IsChecked = true;
} }
} }
private void CBFr_CheckedChanged(object sender, CheckedChangedEventArgs e) private void CBFr_CheckedChanged(object sender, CheckedChangedEventArgs e)
@ -69,8 +69,7 @@ namespace TheGameExtreme.view
{ {
Application.Current.Resources["BlackColor"] = Color.Black; Application.Current.Resources["BlackColor"] = Color.Black;
Application.Current.Resources["WhiteColor"] = Color.White; Application.Current.Resources["WhiteColor"] = Color.White;
Application.Current.Resources["SkyBlueColor"] = Color.SkyBlue; Application.Current.Resources["SkyBlueColor"] = Color.SkyBlue;
} }
else else
{ {
@ -79,17 +78,28 @@ namespace TheGameExtreme.view
Application.Current.Resources["BlueSkyColor"] = Color.SkyBlue; Application.Current.Resources["BlueSkyColor"] = Color.SkyBlue;
} }
} }
private async void SettingToHomePage(object sender, EventArgs e) private async void SettingToHomePage(object sender, EventArgs e)
{ {
string path = @"\Documents\theme.txt"; //serialisationSwitch();
FileStream fs = File.Create(path);
byte[] info = new UTF8Encoding(true).GetBytes(bSwitchSerialisation.ToString());
fs.Write(info, 0, info.Length);
await Navigation.PopAsync(); await Navigation.PopAsync();
} }
/*public void serialisationSwitch()
{
string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "file.xml");
if (!File.Exists(path))
{
XmlSerializer ser = new XmlSerializer(typeof(bool));
using (StreamWriter sw = File.CreateText(path))
{
sw.WriteLine(swTheme.IsToggled);
}
}
}*/
} }
} }

Loading…
Cancel
Save