public bool PopulateSettings(string settingsfile) { if (File.Exists(settingsfile)) { try { if (settingsfile.Length >= 260) { throw new Exception("File Path has to many characters, please relocate"); } FileStream settings = new FileStream(settingsfile, FileMode.Open); XmlSerializer xmls = new XmlSerializer(typeof(ModelSettings)); Settings = (ModelSettings)xmls.Deserialize(settings); settings.Close(); Version v1 = new Version(Settings.Version), v2 = new Version(Properties.Settings.Default.ResumeBreakingVersion); if (v1 < v2) { if (v1.Major != 0) { MessageBox.Show(String.Format("The resume file was built with StochFit {0}, and cannot be reliably loaded in this version. Please see the help file.", Settings.Version)); } else { MessageBox.Show(String.Format("The resume file was built with an older version, and cannot be reliably loaded in this version. Please see the help file.", Settings.Version)); } return(false); } return(true); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message + " - settings file is likely from an older Stochfit version"); return(false); } } else { return(false); } }
public MySettings() { Settings = new ModelSettings(); }