public void LoadSettings() { Settings = new CSettings(); if (!File.Exists(SettingsFileName)) { return; } XmlSerializer xs = null; FileStream fs = null; try { xs = new XmlSerializer(typeof(CSettings)); fs = new FileStream(SettingsFileName, FileMode.Open); Settings = (CSettings)xs.Deserialize(fs); } catch (Exception e) { LogError(e.Message); Settings = new CSettings(); } finally { if (fs != null) { fs.Close(); } } }
public void LoadSettings() { Settings = new CSettings(); if (!File.Exists(SettingsFileName)) return; XmlSerializer xs = null; FileStream fs = null; try { xs = new XmlSerializer(typeof(CSettings)); fs = new FileStream(SettingsFileName, FileMode.Open); Settings = (CSettings)xs.Deserialize(fs); } catch (Exception e) { LogError(e.Message); Settings = new CSettings(); } finally { if (fs != null) fs.Close(); } }