This repository has been archived on 2022-08-05. You can view files and clone it, but cannot push or open issues or pull requests.
LaptopSimulator2015/LaptopSimulator2015/Settings.cs

48 lines
2.0 KiB
C#
Raw Normal View History

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));
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);
new file: .gitignore new file: 1/1.cs new file: 1/1.csproj new file: 1/Properties/AssemblyInfo.cs new file: Base/Base.csproj new file: Base/Input.cs new file: Base/Level.cs new file: Base/Properties/AssemblyInfo.cs new file: LaptopSimulator2015.sln new file: LaptopSimulator2015/App.config new file: LaptopSimulator2015/CaptchaGenerator.cs new file: LaptopSimulator2015/FakeDesktop.Designer.cs new file: LaptopSimulator2015/FakeDesktop.cs new file: LaptopSimulator2015/FakeDesktop.resx new file: LaptopSimulator2015/LaptopSimulator2015.csproj new file: LaptopSimulator2015/Program.cs new file: LaptopSimulator2015/Properties/AssemblyInfo.cs new file: LaptopSimulator2015/Properties/Resources.Designer.cs new file: LaptopSimulator2015/Properties/Resources.resx new file: LaptopSimulator2015/Properties/Settings.Designer.cs new file: LaptopSimulator2015/Properties/Settings.settings new file: LaptopSimulator2015/Resources/fans.wav new file: LaptopSimulator2015/Resources/pcoptimizerpro.jpeg new file: LaptopSimulator2015/Settings.cs new file: LaptopSimulator2015/strings.Designer.cs new file: LaptopSimulator2015/strings.de.Designer.cs new file: LaptopSimulator2015/strings.de.resx new file: LaptopSimulator2015/strings.resx new file: README.md new file: SIT/App.config new file: SIT/MainForm.Designer.cs new file: SIT/MainForm.cs new file: SIT/MainForm.resx new file: SIT/Program.cs new file: SIT/Properties/AssemblyInfo.cs new file: SIT/Properties/Resources.Designer.cs new file: SIT/Properties/Resources.resx new file: SIT/Properties/Settings.Designer.cs new file: SIT/Properties/Settings.settings new file: SIT/SIT.csproj new file: ToDo.txt new file: make.bat
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));
xmldoc_temp.Add(new XElement("level", -1));
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);
quality = int.Parse(xmldoc.Element("quality").Value);
2019-09-14 14:00:28 +02:00
lang = CultureInfo.GetCultureInfo(xmldoc.Element("lang").Value);
new file: .gitignore new file: 1/1.cs new file: 1/1.csproj new file: 1/Properties/AssemblyInfo.cs new file: Base/Base.csproj new file: Base/Input.cs new file: Base/Level.cs new file: Base/Properties/AssemblyInfo.cs new file: LaptopSimulator2015.sln new file: LaptopSimulator2015/App.config new file: LaptopSimulator2015/CaptchaGenerator.cs new file: LaptopSimulator2015/FakeDesktop.Designer.cs new file: LaptopSimulator2015/FakeDesktop.cs new file: LaptopSimulator2015/FakeDesktop.resx new file: LaptopSimulator2015/LaptopSimulator2015.csproj new file: LaptopSimulator2015/Program.cs new file: LaptopSimulator2015/Properties/AssemblyInfo.cs new file: LaptopSimulator2015/Properties/Resources.Designer.cs new file: LaptopSimulator2015/Properties/Resources.resx new file: LaptopSimulator2015/Properties/Settings.Designer.cs new file: LaptopSimulator2015/Properties/Settings.settings new file: LaptopSimulator2015/Resources/fans.wav new file: LaptopSimulator2015/Resources/pcoptimizerpro.jpeg new file: LaptopSimulator2015/Settings.cs new file: LaptopSimulator2015/strings.Designer.cs new file: LaptopSimulator2015/strings.de.Designer.cs new file: LaptopSimulator2015/strings.de.resx new file: LaptopSimulator2015/strings.resx new file: README.md new file: SIT/App.config new file: SIT/MainForm.Designer.cs new file: SIT/MainForm.cs new file: SIT/MainForm.resx new file: SIT/Program.cs new file: SIT/Properties/AssemblyInfo.cs new file: SIT/Properties/Resources.Designer.cs new file: SIT/Properties/Resources.resx new file: SIT/Properties/Settings.Designer.cs new file: SIT/Properties/Settings.settings new file: SIT/SIT.csproj new file: ToDo.txt new file: make.bat
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;
public static int quality;
2019-09-14 14:00:28 +02:00
public static CultureInfo lang;
new file: .gitignore new file: 1/1.cs new file: 1/1.csproj new file: 1/Properties/AssemblyInfo.cs new file: Base/Base.csproj new file: Base/Input.cs new file: Base/Level.cs new file: Base/Properties/AssemblyInfo.cs new file: LaptopSimulator2015.sln new file: LaptopSimulator2015/App.config new file: LaptopSimulator2015/CaptchaGenerator.cs new file: LaptopSimulator2015/FakeDesktop.Designer.cs new file: LaptopSimulator2015/FakeDesktop.cs new file: LaptopSimulator2015/FakeDesktop.resx new file: LaptopSimulator2015/LaptopSimulator2015.csproj new file: LaptopSimulator2015/Program.cs new file: LaptopSimulator2015/Properties/AssemblyInfo.cs new file: LaptopSimulator2015/Properties/Resources.Designer.cs new file: LaptopSimulator2015/Properties/Resources.resx new file: LaptopSimulator2015/Properties/Settings.Designer.cs new file: LaptopSimulator2015/Properties/Settings.settings new file: LaptopSimulator2015/Resources/fans.wav new file: LaptopSimulator2015/Resources/pcoptimizerpro.jpeg new file: LaptopSimulator2015/Settings.cs new file: LaptopSimulator2015/strings.Designer.cs new file: LaptopSimulator2015/strings.de.Designer.cs new file: LaptopSimulator2015/strings.de.resx new file: LaptopSimulator2015/strings.resx new file: README.md new file: SIT/App.config new file: SIT/MainForm.Designer.cs new file: SIT/MainForm.cs new file: SIT/MainForm.resx new file: SIT/Program.cs new file: SIT/Properties/AssemblyInfo.cs new file: SIT/Properties/Resources.Designer.cs new file: SIT/Properties/Resources.resx new file: SIT/Properties/Settings.Designer.cs new file: SIT/Properties/Settings.settings new file: SIT/SIT.csproj new file: ToDo.txt new file: make.bat
2019-07-23 14:54:05 +02:00
}
2019-09-14 14:00:28 +02:00
}