public Settings Load() { Settings settings = new Settings(); if (File.Exists(ServiceProvider.Branding.DefaultSettings)) { settings = LoadSettings(ServiceProvider.Branding.DefaultSettings, settings); } if (ServiceProvider.Branding.ResetSettingsOnLoad) { return(settings); } try { if (!Directory.Exists(Path.GetDirectoryName(ConfigFile))) { Directory.CreateDirectory(Path.GetDirectoryName(ConfigFile)); } if (File.Exists(ConfigFile)) { settings = LoadSettings(ConfigFile, settings); } else { settings.Save(); } settings.LoadPresetData(); } catch (Exception exception) { Log.Error("Error loading config file ", exception); } return(settings); }
public Settings Load() { Settings settings = new Settings(); try { if (!Directory.Exists(Path.GetDirectoryName(ConfigFile))) { Directory.CreateDirectory(Path.GetDirectoryName(ConfigFile)); } if (File.Exists(ConfigFile)) { XmlSerializer mySerializer = new XmlSerializer(typeof (Settings)); FileStream myFileStream = new FileStream(ConfigFile, FileMode.Open); settings = (Settings) mySerializer.Deserialize(myFileStream); myFileStream.Close(); settings.LoadPresetData(); } else { settings.Save(); } } catch (Exception exception) { Log.Error("Error loading config file ", exception); } return settings; }
public Settings Load() { Settings settings = new Settings(); if (File.Exists(ServiceProvider.Branding.DefaultSettings)) settings = LoadSettings(ServiceProvider.Branding.DefaultSettings, settings); if (ServiceProvider.Branding.ResetSettingsOnLoad) return settings; try { if (!Directory.Exists(Path.GetDirectoryName(ConfigFile))) { Directory.CreateDirectory(Path.GetDirectoryName(ConfigFile)); } if (File.Exists(ConfigFile)) { settings = LoadSettings(ConfigFile, settings); } else { settings.Save(); } settings.LoadPresetData(); } catch (Exception exception) { Log.Error("Error loading config file ", exception); } return settings; }