public static AppSettingsBase LoadFromXmlFile(string FileName) { AppSettingsBase result = new AppSettingsBase(); XmlSerializer serializer = new XmlSerializer(typeof(AppSettingsBase)); if (!File.Exists(FileName)) { return(result); } FileStream fs = new FileStream(FileName, FileMode.Open); try { result = (AppSettingsBase)serializer.Deserialize(fs); } finally { if (fs != null) { fs.Close(); } } return(result); }
public static AppSettingsBase Load(string filename) { AppSettingsBase settings = new AppSettingsBase(); Filename = filename; settings = LoadFromXmlFile(Filename); settings.OnLoad(); return(settings); }