public void SaveConfiguration() { ConfigurationManager.SetValue(Resources.UILanguageKey, UILanguage); ConfigurationManager.SetValue(Resources.RestServiceUrlKey, RestServiceUrl); ConfigurationManager.SetValue(Resources.ProxyUserNameKey, Credentials.UserName); ConfigurationManager.SetValue(Resources.ProxyPasswordKey, Credentials.Password); ConfigurationManager.SetValue(Resources.ProxyDomainKey, Credentials.Domain); ConfigurationManager.SetValue(Resources.ProxyUseProxyKey, UseProxyServer.ToString()); ConfigurationManager.SetValue(Resources.AutoSync, AutoSync.ToString()); ConfigurationManager.SetValue(Resources.SyncHour, SyncHour); ConfigurationManager.SetValue(Resources.SyncInterval, SyncInterval.ToString()); ConfigurationManager.Save(); }
/// <summary> /// Saves the Settings /// </summary> public static void SaveSettings() { Logger.Debug("Saving IMDb+ options to file."); #region Scraper XmlWriter xmlWriter = new XmlWriter(); if (!xmlWriter.Load(OptionsFile)) { if (File.Exists(OptionsFile)) { try { File.Delete(OptionsFile); } catch (Exception e) { Logger.Error("Error deleting file: '{0}'", OptionsFile); Logger.Error("Exception: {0}", e.Message); return; } } // create it Logger.Info("Creating new IMDb+ options file."); xmlWriter.CreateXmlConfigFile(OptionsFile); xmlWriter.Load(OptionsFile); } xmlWriter.SetOptionsEntry(cOriginalTitle, "01", OriginalTitle.ToString()); xmlWriter.SetOptionsEntry(cForeignTitle, "02", ForeignTitle.ToString()); xmlWriter.SetOptionsEntry(cForeignFirst, "03", ForeignFirst.ToString()); xmlWriter.SetOptionsEntry(cUkRating, "04", UkRating.ToString()); xmlWriter.SetOptionsEntry(cIMDbScore, "05", IMDbScore.ToString()); xmlWriter.SetOptionsEntry(cIMDbMetaScore, "06", IMDbMetaScore.ToString()); xmlWriter.SetOptionsEntry(cLongSummary, "07", LongSummary.ToString()); xmlWriter.SetOptionsEntry(cRottenMeter, "08", RottenMeter.ToString()); xmlWriter.SetOptionsEntry(cRottenAverage, "09", RottenAverage.ToString()); xmlWriter.SetOptionsEntry(cRottenTopCritics, "10", RottenTopCritics.ToString()); xmlWriter.SetOptionsEntry(cSpecialEdition, "11", SpecialEdition.ToString()); xmlWriter.SetOptionsEntry(cRenameTitles, "12", RenameTitles.ToString()); xmlWriter.SetOptionsEntry(cSingleScore, "13", SingleScore.ToString()); xmlWriter.SetOptionsEntry(cMinIMDbVotes, "14", MinIMDbVotes.ToString()); xmlWriter.SetOptionsEntry(cRefreshAllFields, "15", RefreshAllFields.ToString()); xmlWriter.SetOptionsEntry(cOneWriterDirector, "16", OneWriterDirector.ToString()); xmlWriter.SetOptionsEntry(cRemoveFirstRoman, "17", RemoveFirstRoman.ToString()); xmlWriter.SetOptionsEntry(cFixMissingSummary, "18", FixMissingSummary.ToString()); xmlWriter.SetOptionsEntry(cRatings, "94", Ratings); xmlWriter.SetOptionsEntry(cSecondaryEnglishTitle, "95", SecondaryEnglishTitle.ToString()); xmlWriter.SetOptionsEntry(cSecondarySummary, "96", SecondarySummary.ToString()); xmlWriter.SetOptionsEntry(cSecondaryDetails, "97", SecondaryDetails); xmlWriter.SetOptionsEntry(cCountryFilter, "98", CountryFilter); xmlWriter.SetOptionsEntry(cLanguageFilter, "99", LanguageFilter); // save file xmlWriter.Save(OptionsFile); #endregion #region Plugin using (Settings xmlwriter = new MPSettings()) { xmlwriter.SetValue(cSection, cSyncInterval, SyncInterval.ToString()); xmlwriter.SetValueAsBool(cSection, cSyncOnStartup, SyncOnStartup); xmlwriter.SetValue(cSection, cSyncLastDateTime, SyncLastDateTime.ToString()); xmlwriter.SetValueAsBool(cSection, cDisableNotifications, DisableNotifications); xmlwriter.SetValue(cSection, cMoviesRefreshed, MoviesRefreshed.ToJSON()); } Settings.SaveCache(); #endregion }