You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.0 KiB

using System;
using System.IO;
using System.Xml.Serialization;
namespace OrderStacks.IO
{
class IOOptions
{
static string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Options.xml");
public static void SaveOptionParameter(bool b)
{
XmlSerializer ser = new XmlSerializer(typeof(bool));
TextWriter ws = new StreamWriter(path);
ser.Serialize(ws, b);
ws.Close();
}
public static bool LoadOptionsParameter()
{
XmlSerializer xs = new XmlSerializer(typeof(bool));
try
{
using(FileStream fs = new FileStream(path, FileMode.Open))
{
bool b = (bool)xs.Deserialize(fs);
return b;
}
}
catch
{
//fs.Close();
return false;
}
}
}
}