Example #1
0
        public static void Load()
        {
            XmlSerializer deserializer = new XmlSerializer(typeof(AcSettings));

            if (File.Exists(getFilename()))
            {
                try
                {
                    using (TextReader textReader = new StreamReader(getFilename(), Encoding.UTF8))
                    {
                        instance = (AcSettings)deserializer.Deserialize(textReader);
                    }
                }
                catch (Exception ex)
                {
                    //Debug write the message
                    Debug.WriteLine(ex);
                    //Overwrite the corrupted settings
                    instance = new AcSettings();
                    Save();
                }
            }
            else
            {
                instance = new AcSettings();
                Save();
            }
        }
Example #2
0
 public static void Reset()
 {
     instance = new AcSettings();
 }