public static TesterSettings RecallSettings() { TesterSettings settings = new TesterSettings(); string applDataDir = TesterSettings.BuildApplDataDir(); Pather.AssureDirectoryExists(applDataDir); string applStateFileName = "TesterSettings.xml"; string applStatePath = Path.Combine(applDataDir, applStateFileName); if (File.Exists(applStatePath) == true) { try { using (XmlTextReader tr = new XmlTextReader(applStatePath)) { settings.ReadXml(tr); } } catch (Exception) { settings = new TesterSettings(); } } return(settings); }
public void StoreSettings() { string applDataDir = TesterSettings.BuildApplDataDir(); string applStateFileName = "TesterSettings.xml"; string applStatePath = Path.Combine(applDataDir, applStateFileName); using (StreamWriter stmw = new StreamWriter(applStatePath)) { XmlSerializer xmlser = new XmlSerializer(typeof(TesterSettings)); xmlser.Serialize(stmw, this); } }
/// <summary> /// check that settings exist for the appl. /// </summary> /// <returns></returns> public static bool SettingsExist() { TesterSettings settings = new TesterSettings(); string applDataDir = TesterSettings.BuildApplDataDir(); Pather.AssureDirectoryExists(applDataDir); string applStateFileName = "TesterSettings.xml"; string applStatePath = Path.Combine(applDataDir, applStateFileName); if (File.Exists(applStatePath) == true) { return(true); } else { return(false); } }