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(); } }
public static void Reset() { instance = new AcSettings(); }