2019-09-14 14:00:28 +02:00
|
|
|
|
using System.Globalization;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.Xml.Linq;
|
|
|
|
|
|
|
|
|
|
namespace LaptopSimulator2015 {
|
|
|
|
|
public static class Settings {
|
2019-09-15 16:21:56 +02:00
|
|
|
|
public static readonly string _xmlfile = Path.GetDirectoryName(Application.ExecutablePath) + @"\save.xml";
|
2019-09-14 14:00:28 +02:00
|
|
|
|
public static void Save()
|
|
|
|
|
{
|
|
|
|
|
XElement xmldoc_temp = new XElement("save");
|
|
|
|
|
xmldoc_temp.Add(new XElement("wam", wam));
|
|
|
|
|
xmldoc_temp.Add(new XElement("lsd", lsd));
|
|
|
|
|
xmldoc_temp.Add(new XElement("subs", subs));
|
|
|
|
|
xmldoc_temp.Add(new XElement("level", level));
|
2019-10-06 17:13:10 +02:00
|
|
|
|
xmldoc_temp.Add(new XElement("quality", quality));
|
2019-09-14 14:00:28 +02:00
|
|
|
|
xmldoc_temp.Add(new XElement("lang", lang));
|
2019-09-15 16:21:56 +02:00
|
|
|
|
xmldoc_temp.Save(_xmlfile);
|
2019-07-23 14:54:05 +02:00
|
|
|
|
}
|
2019-09-14 14:00:28 +02:00
|
|
|
|
public static void Load()
|
|
|
|
|
{
|
2019-09-15 16:21:56 +02:00
|
|
|
|
if (!File.Exists(_xmlfile))
|
2019-09-14 14:00:28 +02:00
|
|
|
|
{
|
|
|
|
|
XElement xmldoc_temp = new XElement("save");
|
|
|
|
|
xmldoc_temp.Add(new XElement("wam", 10));
|
|
|
|
|
xmldoc_temp.Add(new XElement("lsd", false));
|
|
|
|
|
xmldoc_temp.Add(new XElement("subs", true));
|
2019-09-28 19:05:06 +02:00
|
|
|
|
xmldoc_temp.Add(new XElement("level", -1));
|
2019-10-06 17:13:10 +02:00
|
|
|
|
xmldoc_temp.Add(new XElement("quality", 1));
|
2019-09-14 14:00:28 +02:00
|
|
|
|
xmldoc_temp.Add(new XElement("lang", CultureInfo.CurrentCulture));
|
2019-09-15 16:21:56 +02:00
|
|
|
|
xmldoc_temp.Save(_xmlfile);
|
2019-09-14 14:00:28 +02:00
|
|
|
|
}
|
2019-09-15 16:21:56 +02:00
|
|
|
|
XElement xmldoc = XElement.Load(_xmlfile);
|
2019-09-14 14:00:28 +02:00
|
|
|
|
wam = int.Parse(xmldoc.Element("wam").Value);
|
|
|
|
|
lsd = bool.Parse(xmldoc.Element("lsd").Value);
|
|
|
|
|
subs = bool.Parse(xmldoc.Element("subs").Value);
|
|
|
|
|
level = int.Parse(xmldoc.Element("level").Value);
|
2019-10-06 17:13:10 +02:00
|
|
|
|
quality = int.Parse(xmldoc.Element("quality").Value);
|
2019-09-14 14:00:28 +02:00
|
|
|
|
lang = CultureInfo.GetCultureInfo(xmldoc.Element("lang").Value);
|
2019-07-23 14:54:05 +02:00
|
|
|
|
}
|
2019-09-14 14:00:28 +02:00
|
|
|
|
public static int wam;
|
|
|
|
|
public static bool lsd;
|
|
|
|
|
public static bool subs;
|
|
|
|
|
public static int level;
|
2019-10-06 17:13:10 +02:00
|
|
|
|
public static int quality;
|
2019-09-14 14:00:28 +02:00
|
|
|
|
public static CultureInfo lang;
|
2019-07-23 14:54:05 +02:00
|
|
|
|
}
|
2019-09-14 14:00:28 +02:00
|
|
|
|
}
|