public static Settings Load(string fileName) { Settings tvntSettings = null; FileStream fileStream = null; try { fileStream = new FileStream(fileName, FileMode.Open); tvntSettings = Settings.Deserialize(fileStream); } catch (FileNotFoundException) { tvntSettings = new Settings(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { if (fileStream != null) { fileStream.Close(); } } return(tvntSettings); }
public Settings MakeCopy() { MemoryStream memoryStream = new MemoryStream(); Serialize(memoryStream); memoryStream.Seek(0, SeekOrigin.Begin); Settings tvntSettingsCopy = Settings.Deserialize(memoryStream); memoryStream.Close(); return((Settings)tvntSettingsCopy); }