public RatingsDefinition(string file) { Logging.Logger.ReportInfo("Loading Certification Ratings from file " + file); this.file = file; Init(); this.settings = XmlSettings<RatingsDefinition>.Bind(this, file); }
public static Window GetDisplayWindow(string xamlFileName, XmlSettings settingsInstance, string windowTitle = "") { if (Windows.ContainsKey(xamlFileName) && Windows[xamlFileName] != null) { return Windows[xamlFileName]; } return CreateDisplayWindow(xamlFileName, settingsInstance, windowTitle); }
public void WriteSettings(XmlSettings settings) { XmlSerializer xml = new XmlSerializer(typeof(XmlSettings)); using (Stream stream = File.Create(logPath)) { xml.Serialize(stream, settings); } }
// for our reset routine public ServiceConfigData() { try { File.Delete(ApplicationPaths.ServiceConfigFile); } catch (Exception e) { MediaBrowser.Library.Logging.Logger.ReportException("Unable to delete config file " + ApplicationPaths.ServiceConfigFile, e); } //continue anyway this.file = ApplicationPaths.ConfigFile; this.settings = XmlSettings<ServiceConfigData>.Bind(this, file); }
public void TestProperty() { ClearConfig(); Monster monster = new Monster(); XmlSettings <Monster> settings = XmlSettings <Monster> .Bind(monster, CONFIG_FILE); monster.Weapon = new Weapon(); monster.Weapon.LaserCount = 99; settings.Write(); monster = new Monster(); settings = XmlSettings <Monster> .Bind(monster, CONFIG_FILE); Assert.AreEqual(monster.Weapon.LaserCount, 99); }
public HAUIManager(string[] aArgs) { // Create settings iSettings = new XmlSettings(KHASettingsFileName); iSettings.Restore(); // Create engine iEngine = new HeapWizardEngine(Application.StartupPath, aArgs); // Find UIs from this assembly iUIs.LoadFromCallingAssembly(new object[] { aArgs, iSettings, iEngine, this }); // Listen to when the application exits so that we can save the settings Application.ApplicationExit += new EventHandler(Application_ApplicationExit); }
public static MyStrings FromFile(string file) { MyStrings strings = new MyStrings(); XmlSettings <MyStrings> .Bind(strings, file); Logger.ReportInfo("Using String Data from " + file); if ("1.0001" != strings.Version) { File.Delete(file); strings = new MyStrings(); XmlSettings <MyStrings> .Bind(strings, file); } return(strings); }
public static MyStrings FromFile(string file) { MyStrings s = new MyStrings(); XmlSettings <MyStrings> settings = XmlSettings <MyStrings> .Bind(s, file); Logger.ReportInfo("Using String Data from " + file); if (VERSION != s.Version) { File.Delete(file); s = new MyStrings(); settings = XmlSettings <MyStrings> .Bind(s, file); } return(s); }
private void Form1_Load(object sender, System.EventArgs e) { bf = new BinaryFormatter(); AppDir = Path.GetDirectoryName(Application.ExecutablePath); xs = new XmlSettings(Path.GetFileNameWithoutExtension(Application.ExecutablePath)); xs.LoadSettings(Path.Combine(AppDir, "settings.xml")); SetPosAndSize(); turPath = xs.ReadSetting(Setting.LastFile, String.Empty); RestoreTurnir(turPath); tabControl1.SelectedIndex = xs.ReadSetting(Setting.LastTab, 0); var ti = xs.ReadSetting(Setting.TableIndex, 0); cbTable.SelectedIndex = ti < cbTable.Items.Count ? ti : 0; }
public XmlSettings ReadSettings() { try { using (var file = File.Open(logPath, FileMode.Open)) { XmlSerializer xml = new XmlSerializer(typeof(XmlSettings)); return((XmlSettings)xml.Deserialize(file)); } } catch (Exception e) { XmlSettings newSettings = new XmlSettings(70, 300, 0); WriteSettings(newSettings); return(newSettings); } }
public static BaseStrings FromFile(string file) { BaseStrings s = new BaseStrings(); XmlSettings <BaseStrings> settings = XmlSettings <BaseStrings> .Bind(s, file); Logger.ReportInfo("Using String Data from " + file); if (VERSION != s.Version && Path.GetFileName(file).ToLower() == ENFILE) { //only re-save the english version as that is the one defined internally File.Delete(file); s = new BaseStrings(); settings = XmlSettings <BaseStrings> .Bind(s, file); } return(s); }
public XmlSettings ReadSettings() { try { using (var file = File.Open(logPath, FileMode.Open)) { XmlSerializer xml = new XmlSerializer(typeof(XmlSettings)); return (XmlSettings)xml.Deserialize(file); } } catch (Exception e) { XmlSettings newSettings = new XmlSettings(70, 300, 0); WriteSettings(newSettings); return newSettings; } }
public IEnumerator LoadWebSettings() { var www = new WWW(Application.dataPath + @"/settings.xml"); yield return(www); if (!string.IsNullOrEmpty(www.error)) { Debug.LogError(www.error); } else { CoreContext.Settings = XmlSettings.Create(www.text); CoreContext.UserData = XmlUserData.Create(); } }
public void XmlSettingsSave(XmlSettings aSettings, string aCategory) { aSettings.Clear(); aSettings[aCategory, "__Count"] = Count; int index = 0; foreach (DbgEntity entity in this) { string entityCategory = string.Format("DbgEntity_{0:d5}", index++); // Get the category where we'll save the settings for this entity to... XmlSettingCategory category = aSettings[entityCategory]; // Save entity specific settings entity.Save(category); } }
public void TestList() { ClearConfig(); Group group = new Group(); group.People = new List <Person>(); group.People.Add(new Person()); group.People.Add(new Person()); XmlSettings <Group> settings = XmlSettings <Group> .Bind(group, CONFIG_FILE); settings.Write(); group = new Group(); settings = XmlSettings <Group> .Bind(group, CONFIG_FILE); Assert.AreEqual(group.People.Count, 2); }
/// <summary> /// I wrote this when the program crashed after an hour. /// Intermediate results can now be saved to avoid losing data. /// </summary> private static void SaveIntermediateResult(Core core, Guid guid, int value, int repetition, ResultClusterer result, ProgressReporter proggy) { string fileName = UiControls.GetTemporaryFile("." + value + "." + repetition + ".intermediate.dat", guid); LookupByGuidSerialiser guidS = core.GetLookups(); proggy.Enter("Saving intermediate results"); XmlSettings.Save <ResultClusterer>(new FileDescriptor(fileName, SerialisationFormat.MSerialiserFastBinary), result, guidS, proggy); if (core.SetLookups(guidS)) { // UIDs have changed SaveSession(core, proggy); } proggy.Leave(); }
private void button6_Click(object sender, EventArgs e) { string xmlpath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase; XmlSettings xmlSettings = new XmlSettings(xmlpath + @"CreateCodeSelect.xml"); xmlSettings.cleanupXML(); foreach (TreeNode nitem in treeView1.Nodes) { if (nitem.Nodes.Count > 0) { foreach (TreeNode cnitem in nitem.Nodes) { xmlSettings.addBoolean(cnitem.Name, cnitem.Checked); } } } }
/// <summary> /// Loads results from file. /// </summary> public static ClusterEvaluationResults LoadResults(Core core, string fileName, ProgressReporter z) { LookupByGuidSerialiser guidS = core.GetLookups(); ClusterEvaluationResults set; set = XmlSettings.LoadOrDefault <ClusterEvaluationResults>(fileName, null, guidS, z); if (set != null) { if (set.CoreGuid != core.CoreGuid) { throw new InvalidOperationException("Wrong Session - The result set selected was not created using the current session. In order to view these results you must load the relevant session.\r\n\r\nCurrent session: " + core.CoreGuid + "\r\nResults session: " + set.CoreGuid); } } return(set); }
async Task <StartupResult> StartupImpl() { var startupResult = new StartupResult(); // TODO: let user opt-in/-out this.EnableTelemetry(); this.localSettings = XmlSettings.Create(this.localSettingsFolder); this.roamingSettings = XmlSettings.Create(this.roamingSettingsFolder); this.settings = await this.InitializeSettingsSet <BoilerplateSettings>("App.Boilerplate.xml"); bool termsVersionMismatch = this.settings.AcceptedTerms != LicenseTermsAcceptance.GetTermsAndConditionsVersion(); if (termsVersionMismatch) { var termsWindow = new LicenseTermsAcceptance(); if (!true.Equals(termsWindow.ShowDialog())) { this.Shutdown(); startupResult.LaunchCancelled = true; return(startupResult); } termsWindow.Close(); this.settings.AcceptedTerms = LicenseTermsAcceptance.GetTermsAndConditionsVersion(); startupResult.TermsUpdated = true; } string version = this.Version is null ? "N/A" : Invariant($"{this.Version.Major}.{this.Version.Minor}"); if (this.settings.WhatsNewVersionSeen != version && this.WhatsNew != null) { this.ShowNotification(title: this.WhatsNew.Title, message: this.WhatsNew.Message, navigateTo: this.WhatsNew.DetailsUri); } this.settings.WhatsNewVersionSeen = version; return(startupResult); }
private void Initialize() { #if UNITY_WEBPLAYER && !UNITY_EDITOR StartCoroutine(LoadWebSettings()); #else CoreContext.Settings = XmlSettings.Create(); CoreContext.UserData = XmlUserData.Create(); XmlUserData.UpdateSubGameBaseInfoList(CoreContext.Settings.SubGameBaseInfoList); #endif CoreContext.AudioController = new Core.Model.Audio.AudioController(); if (!CoreContext.AudioController.LoadSnapshot(CoreContext.UserData.Common.AudioControllerSnapshot)) { CoreContext.AudioController.LoadSnapshot(CoreContext.Settings.DefaultAudioControllerSnapshot); } Application.LoadLevelAdditive(CoreContext.Settings.GameSceneArray.StartSceneName); }
public static DialogResult ShowDialog(XmlSettings aSettings, out string aFileName, out string aFilter) { RawStackImportDialog self = new RawStackImportDialog(aSettings); DialogResult result = self.ShowDialog(); // if (result == DialogResult.OK) { aFileName = self.iFileName; aFilter = self.iFilter; } else { aFileName = string.Empty; aFilter = string.Empty; } // return(result); }
public void BasicValueTypeTest() { ClearConfig(); var person = new Person(); XmlSettings <Person> settings = XmlSettings <Person> .Bind(person, CONFIG_FILE); person.Age = 3; person.Name = "Sam"; person.Happy = false; person.Birthdate = DateTime.Today; settings.Write(); person = new Person(); settings = XmlSettings <Person> .Bind(person, CONFIG_FILE); Assert.AreEqual(person.Age, 3); Assert.AreEqual(person.Name, "Sam"); Assert.AreEqual(person.Happy, false); Assert.AreEqual(person.Birthdate, DateTime.Today); }
private void GetSettingsAndFillControls() { xml = FL_RPC.ReadSettings(); noPrj_txt.Text = xml.NoNameMessage; SecMode_txt.Text = xml.SecretMessage; if (xml.Secret) { sec_mode_sel.Checked = true; def_mode_selector.Checked = false; } else if (!xml.Secret) { sec_mode_sel.Checked = false; def_mode_selector.Checked = true; } debugLevel_sel.Value = (int)xml.logLevel; numericUpDown1.Value = xml.RefeshInterval / 1000; textBox1.Text = xml.ClientID; numericUpDown2.Value = xml.Pipe; }
private void SaveSettings() { XmlSettings settings = new XmlSettings(); settings.ClientID = textBox1.Text; settings.RefeshInterval = (int)numericUpDown1.Value * 1000; settings.Pipe = (int)numericUpDown2.Value; settings.logLevel = (DiscordRPC.Logging.LogLevel)debugLevel_sel.Value; settings.SecretMessage = SecMode_txt.Text; settings.NoNameMessage = noPrj_txt.Text; if (sec_mode_sel.Checked && !def_mode_selector.Checked) { settings.Secret = true; } else if (!sec_mode_sel.Checked && def_mode_selector.Checked) { settings.Secret = false; } settings.AcceptedWarning = dangerZone_enable.Checked; FL_RPC.SaveToXml(settings); }
/// <summary> /// Saves results to file /// /// Returns pointer (unless originalPointer is NULL, in which case the action is assumed to be an export and is ignored). /// </summary> private static ClusterEvaluationPointer SaveResults(Core core, string fileName, ClusterEvaluationPointer originalPointer, ClusterEvaluationResults results, ProgressReporter proggy) { LookupByGuidSerialiser guidS = core.GetLookups(); proggy.Enter("Saving results"); XmlSettings.Save <ClusterEvaluationResults>(fileName, results, guidS, proggy); if (core.SetLookups(guidS)) { // UIDs have changed SaveSession(core, proggy); } proggy.Leave(); if (originalPointer == null) { return(null); } return(new ClusterEvaluationPointer(fileName, originalPointer.Configuration)); }
public ConfigMember(MemberInfo info, ConfigData data) { this.data = data; this.Info = info; this.Name = info.Name; this.Group = XmlSettings <ConfigData> .GetGroup(info); this.Comment = XmlSettings <ConfigData> .GetComment(info); this.PresentationStyle = XmlSettings <ConfigData> .GetPresentationStyle(info); this.IsDangerous = XmlSettings <ConfigData> .IsDangerous(info); if (info.MemberType == MemberTypes.Property) { this.Type = (info as PropertyInfo).PropertyType; } else if (info.MemberType == MemberTypes.Field) { this.Type = (info as FieldInfo).FieldType; } }
/// <summary> /// Initalizes an RPC client instance and starts it /// </summary> public static void Init() { settings = ReadSettings(); string ClientID = settings.ClientID; int DPipe = settings.Pipe; using (client = new DiscordRpcClient(ClientID, false, DPipe)) { //Set log levels logLevel = settings.logLevel; client.Logger = new ConsoleLogger() { Level = logLevel, Coloured = true }; //Event registration client.OnReady += OnReady; client.OnClose += OnClose; client.OnError += OnError; client.OnConnectionEstablished += OnConnectionEstablished; client.OnConnectionFailed += OnConnectionFailed; client.OnPresenceUpdate += OnPresenceUpdate; //Set additional rp info rp.Timestamps = new Timestamps() { Start = DateTime.UtcNow }; //'link' rp with client client.SetPresence(rp); //Initilize the client and return client.Initialize(); Start(); } }
public MyConfigData(string file) { this.file = file; this.settings = XmlSettings <MyConfigData> .Bind(this, file); bool changed = false; //translate defintions to actual profiles foreach (ProfileDefinition def in ProfileDefs) { changed = changed | Migrate(def); Profiles.Add(def.Directory.ToLower(), new Profile(def.MovieLocation, def.SeriesLocation, def.SeasonLocation, def.EpisodeLocation, def.RemoteLocation, def.ThumbLocation, def.AlbumLocation, def.FolderLocation, def.CoverByDefinition, def.TypeMap)); } //and add in default if not already there if (!Profiles.ContainsKey("default")) { Profiles.Add("default", new Profile()); } if (changed) { this.Save(); } }
// returns true, if a default config is set (requires full reload on entering plugin) //-------------------------------------------------------------------------------------------- // Return Current Configuration //-------------------------------------------------------------------------------------------- public static bool Current_Config(bool showmenu) { CurrentConfig = null; bool isDefaultConfig = false; using (var xmlConfig = new XmlSettings(Config.GetFile(Config.Dir.Config, "MyFilms.xml"))) { NbConfig = xmlConfig.ReadXmlConfig("MyFilms", "MyFilms", "NbConfig", 0); PluginMode = xmlConfig.ReadXmlConfig("MyFilms", "MyFilms", "PluginMode", "normal"); // Reads Plugin start mode and sets to normal if not present LogMyFilms.Info("MyFilms ********** OperationsMode (PluginMode): '" + PluginMode + "' **********"); if (NbConfig == 0) { GUIUtils.ShowOKDialog(GUILocalizeStrings.Get(10799601), GUILocalizeStrings.Get(10799602), GUILocalizeStrings.Get(10799603), ""); // No configuration found ! // please enter setup first // to create a MyFilms config. return false; // return NewConfigWizard(); } bool boolchoice = true; if (CurrentConfig == null) CurrentConfig = xmlConfig.ReadXmlConfig("MyFilms", "MyFilms", "Current_Config", string.Empty).Length > 0 ? xmlConfig.ReadXmlConfig("MyFilms", "MyFilms", "Current_Config", string.Empty) : string.Empty; if (!(xmlConfig.ReadXmlConfig("MyFilms", "MyFilms", "Menu_Config", false)) && (xmlConfig.ReadXmlConfig("MyFilms", "MyFilms", "Default_Config", string.Empty).Length > 0)) { CurrentConfig = xmlConfig.ReadXmlConfig("MyFilms", "MyFilms", "Default_Config", string.Empty); isDefaultConfig = true; } if (showmenu) { if (CurrentConfig == string.Empty || (xmlConfig.ReadXmlConfig("MyFilms", "MyFilms", "Menu_Config", true))) { boolchoice = false; CurrentConfig = Configuration.ChoiceConfig(MyFilms.ID_MyFilms); // "" => user esc's dialog on plugin startup so exit plugin unchanged } CurrentConfig = Configuration.ControlAccessConfig(CurrentConfig, MyFilms.ID_MyFilms); if ((CurrentConfig == "") && (NbConfig > 1) && (boolchoice)) //error password ? so if many config => choice config menu CurrentConfig = Configuration.ChoiceConfig(MyFilms.ID_MyFilms); } } return isDefaultConfig; }
public void SetSettings(XmlSettings newSettings) { this.settings = newSettings; SettingsSerializer.Instance.WriteSettings (settings); }
/// <summary> /// XMLファイルから設定を読み込み、クラス内のプロパティに設定する /// </summary> /// /// <param name="filename">読み込むXMLファイル名</param> /// <returns>IDをキー、Passwodを値としたハッシュテーブル</returns> public static void loadSettings(string filename) { string filepath = ""; if (Path.IsPathRooted(filename)) { filepath = filename; filename = Path.GetFileName(filename); } else { filepath = Path.GetFullPath(Environment.CurrentDirectory + @"\" + filename); } if (File.Exists(filepath)) { try { System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(TricksterTools.Library.Xml.Settings.XmlTricksterRoot)); System.IO.FileStream fs = new System.IO.FileStream(filepath, System.IO.FileMode.Open); TricksterTools.Library.Xml.Settings.XmlTricksterRoot XmlRoot = (TricksterTools.Library.Xml.Settings.XmlTricksterRoot)serializer.Deserialize(fs); XmlSettings Tools = new XmlSettings(); if (XmlRoot.Tools.name != "TSLoginManager") { MessageBox.Show("TSLoginManager以外の設定ファイルが読み込まれています。" + Environment.NewLine + "設定は読み込まれませんでした。", "設定読み込みエラー", MessageBoxButtons.OK, MessageBoxIcon.Warning); HungUp.enable = false; HungUp.sec = 60; Update.startupAutoCehck = false; Update.checkBetaVersion = false; GameStartUp.mode = RUN_GAME_DIRECT; //Logging.enable = false; //Logging.fileName = Environment.CurrentDirectory + @"\debug.log"; Icons.resourceName = "char99"; return; } Tools = XmlRoot.Tools.Settings; // Logging設定 /* * try * { * if (Tools.Logging.enable == "true") * { * Logging.enable = true; * } * else * { * Logging.enable = false; * } * } * catch (Exception e) * { * SimpleLogger.WriteLine(e.Message); * Logging.enable = false; * } * try * { * Logging.filePath = Tools.Logging.Path; * } * catch (Exception e) * { * SimpleLogger.WriteLine(e.Message); * Logging.filePath = Environment.CurrentDirectory + "\\logs"; * } */ // アイコン設定 try { Icons.resourceName = Tools.Icon.resourceName; } catch (Exception e) { SimpleLogger.WriteLine(e.Message); Icons.resourceName = "char99"; // default } // フリーズ設定 try { if (Tools.HungupTime.enable == "true") { HungUp.enable = true; } else { HungUp.enable = false; } } catch (Exception e) { SimpleLogger.WriteLine(e.Message); SimpleLogger.WriteLine("load default: [HungUp] enable"); HungUp.enable = true; } try { HungUp.sec = Tools.HungupTime.sec; } catch (Exception e) { SimpleLogger.WriteLine(e.Message); SimpleLogger.WriteLine("load default: [HungUp] time = 60"); HungUp.sec = 60; } // アップデートチェック設定 try { if (Tools.UpdateCheck.startup.ToLower() == "true") { Update.startupAutoCehck = true; } else { Update.startupAutoCehck = false; } } catch (Exception e) { SimpleLogger.WriteLine(e.Message); SimpleLogger.WriteLine("load default: [StartupAutoCheck] false"); Update.startupAutoCehck = false; } // ベータアップデート設定 try { if (Tools.UpdateCheck.checkBeta.ToLower() == "true") { Update.checkBetaVersion = true; } else { Update.checkBetaVersion = false; } } catch (Exception e) { SimpleLogger.WriteLine(e.Message); SimpleLogger.WriteLine("load default: [BetaCheck] false"); Update.checkBetaVersion = false; } // ゲーム起動方法設定 try { GameStartUp.mode = Tools.StartUpGame.mode; } catch (Exception e) { SimpleLogger.WriteLine(e.Message); SimpleLogger.WriteLine("load default: [GameStartUp] mode=0"); GameStartUp.mode = RUN_GAME_DIRECT; } } catch (FileLoadException fle) { SimpleLogger.WriteLine(fle.Message); MessageBox.Show("例外エラー:" + Environment.NewLine + "ファイルの読み込みに失敗しました。", "FileLoadException error", MessageBoxButtons.OK, MessageBoxIcon.Error); HungUp.sec = 60; HungUp.enable = true; Update.startupAutoCehck = false; Update.checkBetaVersion = false; GameStartUp.mode = RUN_GAME_DIRECT; Icons.resourceName = "char99"; } catch (System.Xml.XmlException xe) { SimpleLogger.WriteLine(xe.Message); MessageBox.Show("例外エラー:" + Environment.NewLine + "データの処理に失敗しました。", "XmlException error", MessageBoxButtons.OK, MessageBoxIcon.Error); HungUp.sec = 60; HungUp.enable = true; Update.startupAutoCehck = false; Update.checkBetaVersion = false; GameStartUp.mode = RUN_GAME_DIRECT; Icons.resourceName = "char99"; } catch (System.InvalidOperationException ioe) { SimpleLogger.WriteLine(ioe.Message); MessageBox.Show("例外エラー:" + Environment.NewLine + "無効なメソッドの呼び出しが行われました。", "InvalidOperationException error", MessageBoxButtons.OK, MessageBoxIcon.Error); HungUp.sec = 60; HungUp.enable = true; Update.startupAutoCehck = false; Update.checkBetaVersion = false; GameStartUp.mode = RUN_GAME_DIRECT; Icons.resourceName = "char99"; } } else { SimpleLogger.WriteLine("setting file 'settings.xml' could not read/found."); MessageBox.Show("設定ファイルを読み込めませんでした。" + Environment.NewLine + "'" + filepath + "'", "TSLoginManager", MessageBoxButtons.OK, MessageBoxIcon.Warning); HungUp.sec = 60; HungUp.enable = true; Update.startupAutoCehck = false; Update.checkBetaVersion = false; GameStartUp.mode = RUN_GAME_DIRECT; Icons.resourceName = "char99"; } }
public Logos() { // BackgroundWorker bgLogos = new System.ComponentModel.BackgroundWorker(); // string activeLogoConfigFile = Config.GetFile(Config.Dir.Config, "MyFilmsLogos_" + Configuration.CurrentConfig + ".xml"); // Default config customized logofile //string activeLogoConfig = "MyFilmsLogos_" + Configuration.CurrentConfig; string logoConfigPathSkin; string skinLogoPath; string activeLogoConfigFile = String.Empty; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings()) { skinLogoPath = Config.GetDirectoryInfo(Config.Dir.Skin) + @"\" + xmlreader.GetValueAsString("skin", "name", "DefaultWide") + @"\Media\Logos"; // Get current path to logos in skindirectory logoConfigPathSkin = Config.GetDirectoryInfo(Config.Dir.Skin) + @"\" + xmlreader.GetValueAsString("skin", "name", "DefaultWide"); // Get current path to active skin directory } if (File.Exists(logoConfigPathSkin + @"\MyFilmsLogos.xml")) { try { activeLogoConfigFile = logoConfigPathSkin + @"\MyFilmsLogos.xml"; LogoConfigOverride = "O"; LogMyFilms.Debug("Using Skin specific logo config file: '" + activeLogoConfigFile + "'"); //wfile = wfile.Substring(wfile.LastIndexOf("\\") + 1) + "_" + Configuration.CurrentConfig; } catch { LogMyFilms.Debug("Error copying config specific file from skin override file !"); } } else { activeLogoConfigFile = Config.GetDirectoryInfo(Config.Dir.Config) + @"\MyFilmsLogos.xml"; LogoConfigOverride = ""; LogMyFilms.Debug("Using MyFilms default logo config file: '" + activeLogoConfigFile + "'"); } using (XmlSettings xmlConfig = new XmlSettings(activeLogoConfigFile)) { // First check, if Config specific LogoConfig exists, if not create it from default file! LogosPath = xmlConfig.ReadXmlConfig(activeLogoConfigFile, "ID0000", "LogosPath", ""); //Recreate the path to make it OS independant... if (LogosPath.Length < 1) // Fall back to default skin logos ! { LogosPath = skinLogoPath; } else { if (LogosPath.ToLower().Contains(@"Team Mediaportal\Mediaportal".ToLower())) { int pos = LogosPath.ToLower().LastIndexOf(@"Team Mediaportal\Mediaportal".ToLower()); LogosPath = LogosPath.Substring(pos + @"Team Mediaportal\Mediaportal".Length); LogosPath = Config.GetDirectoryInfo(Config.Dir.Config) + LogosPath; } } if (LogosPath.LastIndexOf("\\", StringComparison.Ordinal) != LogosPath.Length - 1) LogosPath = LogosPath + "\\"; Spacer = xmlConfig.ReadXmlConfig(activeLogoConfigFile, "ID0000", "Spacing", 1); Country = xmlConfig.ReadXmlConfig(activeLogoConfigFile, "ID0000", "Country", string.Empty); // use Country setting of Logos if available if (Country.Length > 0) { UseCountryLogos = true; //if (Directory.Exists(LogosPath + Country) || LogoFileList.Any(x => x.IndexOf("\\" + Country + "\\", StringComparison.OrdinalIgnoreCase) >= 0)) //{ //} } else { // fallback to use MP language, if directory exists and no specific country setting in logo manager if (Directory.Exists(LogosPath + MyFilmsSettings.MPLanguage) || LogoFileList.Any(x => x.IndexOf("\\" + MyFilmsSettings.MPLanguage + "\\", StringComparison.OrdinalIgnoreCase) >= 0)) { Country = MyFilmsSettings.MPLanguage; UseCountryLogos = true; } } if (UseCountryLogos) MyFilmsDetail.setGUIProperty("config.country", Country, true); LogMyFilms.Debug("Logo path for reading logos : '" + LogosPath + "'"); LogMyFilms.Debug("Logo path for storing cached logos : '" + LogosPathThumbs + "' with spacing = '" + Spacer + "'"); LogMyFilms.Debug("Logo Country : '" + Country + "', MP language = '" + MyFilmsSettings.MPLanguage + "', UseCountryLogos = '" + UseCountryLogos + "'"); #region read logo rules int i = 0; ID2001Logos.Clear(); ID2002Logos.Clear(); ID2003Logos.Clear(); ID2012Logos.Clear(); do { string wline = xmlConfig.ReadXmlConfig(activeLogoConfigFile, "ID2001", "ID2001_" + i, null); if (wline == null) break; ID2001Logos.Add(wline); i++; } while (true); i = 0; do { string wline = xmlConfig.ReadXmlConfig(activeLogoConfigFile, "ID2002", "ID2002_" + i, null); if (wline == null) break; ID2002Logos.Add(wline); i++; } while (true); i = 0; do { string wline = xmlConfig.ReadXmlConfig(activeLogoConfigFile, "ID2003", "ID2003_" + i, null); if (wline == null) break; ID2003Logos.Add(wline); i++; } while (true); #endregion } }
private void Apply() { int ageInt, timerInt; try { ageInt = int.Parse(age); if (ageInt <= 0) { message = "AGE MUST BE GREATER THAN 0"; errorMessage = true; return; } else if (ageInt >= 150) { message = "AGE MUST BE LESS THAN 150"; errorMessage = true; return; } } catch (Exception) { message = "AGE IS IN INCORRECT FORMAT\nPLEASE ENTER A WHOLE NUMBER"; errorMessage = true; return; } try { timerInt = int.Parse(timer); if (timerInt <= 0) { message = "TIME MUST BE GREATER THAN 0 SECONDS"; errorMessage = true; return; } else if (timerInt > 300) { message = "TIME MUST BE LESS THAN 300 SECONDS"; errorMessage = true; return; } } catch (Exception) { message = "TIME IS IN INCORRECT FORMAT\nPLEASE ENTER A WHOLE NUMBER"; errorMessage = true; return; } try { settings = new XmlSettings(ageInt, timerInt, Convert.ToInt32(!male)); PlayerSettings.Instance.SetSettings(settings); Back(); } catch (Exception e) { Debug.LogError(e.Message); message = "UNEXPECTED ERROR"; messageEnd = "\nPLEASE CONTINUE WITHOUT SAVING"; errorMessage = true; } }
//-------------------------------------------------------------------------------------------- // Choice Configuration //-------------------------------------------------------------------------------------------- public static string ChoiceConfig(int GetID) { var dlg = (MediaPortal.Dialogs.GUIDialogMenu)MediaPortal.GUI.Library.GUIWindowManager.GetWindow((int)MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { MyFilms.conf.StrFileXml = string.Empty; return string.Empty; } dlg.Reset(); dlg.SetHeading(GUILocalizeStrings.Get(6022)); // Choose MyFilms DB Config using (var xmlConfig = new XmlSettings(Config.GetFile(Config.Dir.Config, "MyFilms.xml"))) { //XmlConfig XmlConfig = new XmlConfig(); int mesFilmsNbConfig = xmlConfig.ReadXmlConfig("MyFilms", "MyFilms", "NbConfig", -1); for (int i = 0; i < mesFilmsNbConfig; i++) dlg.Add(xmlConfig.ReadXmlConfig("MyFilms", "MyFilms", "ConfigName" + i, string.Empty)); dlg.DoModal(GetID); if (dlg.SelectedLabel == -1) { try { MyFilms.conf.StrFileXml = string.Empty; } catch (Exception ex) { LogMyFilms.Debug("MF: Error resetting config, as not yet loaded into memory - exception: " + ex); } return string.Empty; } if (dlg.SelectedLabelText.Length > 0) { string catalog = xmlConfig.ReadXmlConfig("MyFilms", dlg.SelectedLabelText, "AntCatalog", string.Empty); if (!System.IO.File.Exists(catalog)) { GUIUtils.ShowOKDialog( "Cannot load Configuration:", "'" + dlg.SelectedLabelText + "'", "Verify your settings !", ""); return string.Empty; } else { return dlg.SelectedLabelText; } } } return string.Empty; }
public LaunchManager() { //the following is needed on linux... the current directory must be the Mono executable, which is bad. Environment.CurrentDirectory = Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location); try { FormIcon = Icon.FromHandle(Resources.IconSmall.GetHicon()); if (File.Exists(_pathLogFile)) { File.Delete(_pathLogFile); } XmlPreferences prefs = new XmlPreferences(); try { prefs = _prefsSerializer.Deserialize(_pathPrefsFile, new XmlPreferences()); } catch (Exception ex) { Command_Display_Error("Read preferences file", _pathPrefsFile, ex, "Special preferences will be reset"); } Preferences = prefs; Logger = new LoggerConfiguration().WriteTo.File(_pathLogFile, LogEventLevel.Verbose).MinimumLevel.Is(Preferences.MinimumEventLevel).CreateLogger(); AppInfoFactory gameInfoFactory; gameInfoFactory = !File.Exists(_pathGameInfoAssembly) ? null : PatchingHelper.LoadAppInfoFactory(_pathGameInfoAssembly); var settings = new XmlSettings(); var history = new XmlHistory(); ; try { history = _historySerializer.Deserialize(_pathHistoryXml, new XmlHistory()); } catch (Exception ex) { Command_Display_Error("Load patching history", _pathHistoryXml, ex, "If the launcher was terminated unexpectedly last time, it may not be able to recover."); } try { settings = _settingsSerializer.Deserialize(_pathSettings, new XmlSettings()); } catch (Exception ex) { Command_Display_Error("Read settings file", _pathSettings, ex, "Patch list and other settings will be reset."); } string folderDialogReason = null; if (settings.BaseFolder == null) { folderDialogReason = "(no game folder has been specified)"; } else if (!Directory.Exists(settings.BaseFolder)) { folderDialogReason = "(the previous game folder does not exist)"; } if (folderDialogReason != null) { if (!Command_SetGameFolder_Dialog(folderDialogReason)) { Command_ExitApplication(); } } else { BaseFolder = settings.BaseFolder; } _home = new guiHome(this) { Icon = FormIcon }; var defaultAppInfo = new AppInfo() { AppName = "No AppInfo.dll", }; AppInfo = gameInfoFactory?.CreateInfo(new DirectoryInfo(BaseFolder)) ?? defaultAppInfo; AppInfo.AppVersion = AppInfo.AppVersion ?? "version??"; var icon = TryOpenIcon(AppInfo.IconLocation) ?? _home.Icon.ToBitmap(); ProgramIcon = icon; Instructions = new DisposingBindingList<PatchInstruction>(); var instructions = new List<XmlInstruction>(); foreach (var xmlPatch in settings.Instructions) { try { Command_Direct_AddPatch(xmlPatch.PatchPath, xmlPatch.IsEnabled); } catch { instructions.Add(xmlPatch); } } var patchList = instructions.Select(x => x.PatchPath).Join(Environment.NewLine); if (patchList.Length > 0) { Command_Display_Error("Load patches on startup.", patchList); } try { PatchingHelper.RestorePatchedFiles(AppInfo, history.Files); } catch (Exception ex) { Command_Display_Error("Restore files", ex: ex); } //File.Delete(_pathHistoryXml); _home.Closed += (sender, args) => Command_ExitApplication(); _icon = new NotifyIcon { Icon = FormIcon, Visible = false, Text = "Patchwork Launcher", ContextMenu = new ContextMenu { MenuItems = { new MenuItem("Quit", (o, e) => Command_ExitApplication()) } } }; File.Delete(_pathHistoryXml); } catch (Exception ex) { Command_Display_Error("Launch the application", ex: ex, message: "The application will now exit."); Command_ExitApplication(); } }
public KeyFile(string file) { this.file = file; this.settings = XmlSettings<KeyFile>.Bind(this, file); }
public HAUIConsole(string[] aArgs, XmlSettings aSettings, HeapWizardEngine aEngine, ITracer aTracer) : base(aArgs, aSettings, aEngine, aTracer) { iInputs = new HACmdLineInputParameters(this, aEngine); }
private Connector(string settingsPath) { Observers = new List <IConnectorObserver>(); _xmlSettings = new XmlSettings(settingsPath); }
internal static Window CreateDisplayWindow (string xamlFileName, XmlSettings settingsInstance, string windowTitle) { var configWindow = new Window(); try { var assemblyPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); var pluginPath = Path.Combine(assemblyPath, "plugins"); if (assemblyPath == null) return null; var xamlInterfaceFile = FileManager.GetFile(pluginPath, xamlFileName); if (!File.Exists(xamlInterfaceFile)) return null; var xamlContent = File.ReadAllText(xamlInterfaceFile); configWindow.DataContext = settingsInstance; var mainControl = (UserControl) XamlReader.Load(new MemoryStream(Encoding.UTF8.GetBytes(xamlContent))); Action<object, CancelEventArgs> closingHandler = delegate(object sender, CancelEventArgs e) { if (!CloseAllowed) { settingsInstance.Save(); configWindow.Visibility = Visibility.Hidden; e.Cancel = true; Logger.Debug("Hiding {0} Window", windowTitle); } else { Logger.Debug("Closing {0} Window", windowTitle); } }; var windowBorderSize = 16; var windowHeaderSize = 37; configWindow.Content = mainControl; configWindow.Width = mainControl.Width + windowBorderSize; configWindow.Height = mainControl.Height + windowHeaderSize; configWindow.Title = windowTitle; configWindow.Closing += (s,e) => closingHandler(s,e); configWindow.Owner = Application.Current.MainWindow; configWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; Application.Current.MainWindow.Closing += Application_Closing; Windows.Add(xamlFileName, configWindow); return configWindow; } catch (Exception ex) { Logger.Debug("Failed to load Config UI {0}", ex); } return null; }
private PlayerSettings() { settings = SettingsSerializer.Instance.ReadSettings (); }
//-------------------------------------------------------------------------------------------- // Control Acces to asked configuration //-------------------------------------------------------------------------------------------- public static string ControlAccessConfig(string configname, int GetID) { if (configname.Length == 0) return ""; using (var xmlConfig = new XmlSettings(Config.GetFile(Config.Dir.Config, "MyFilms.xml"))) { string Dwp = xmlConfig.ReadXmlConfig("MyFilms", configname, "Dwp", string.Empty); if (Dwp.Length == 0) { return configname; } var keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); if (null == keyboard) { return string.Empty; } keyboard.Reset(); keyboard.SetLabelAsInitialText(false); // set to false, otherwise our intial text is cleared keyboard.Text = string.Empty; keyboard.Password = true; keyboard.DoModal(GetID); if ((keyboard.IsConfirmed) && (keyboard.Text.Length > 0)) { var crypto = new Crypto(); if (crypto.Decrypter(Dwp) == keyboard.Text) return configname; } return string.Empty; } }
public HAUIGraphical(string[] aArgs, XmlSettings aSettings, HeapWizardEngine aEngine, ITracer aTracer) : base(aArgs, aSettings, aEngine, aTracer) { }
internal static Window CreateDisplayWindow(string xamlFileName, XmlSettings settingsInstance, string windowTitle) { var configWindow = new Window(); try { var assemblyPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); var pluginPath = Path.Combine(assemblyPath, "plugins"); if (assemblyPath == null) { return(null); } var xamlInterfaceFile = FileManager.GetFile(pluginPath, xamlFileName); if (!File.Exists(xamlInterfaceFile)) { return(null); } var xamlContent = File.ReadAllText(xamlInterfaceFile); configWindow.DataContext = settingsInstance; var mainControl = (UserControl)XamlReader.Load(new MemoryStream(Encoding.UTF8.GetBytes(xamlContent))); Action <object, CancelEventArgs> closingHandler = delegate(object sender, CancelEventArgs e) { if (!CloseAllowed) { settingsInstance.Save(); configWindow.Visibility = Visibility.Hidden; e.Cancel = true; Logger.Debug("Hiding {0} Window", windowTitle); } else { Logger.Debug("Closing {0} Window", windowTitle); } }; var windowBorderSize = 16; var windowHeaderSize = 37; configWindow.Content = mainControl; configWindow.Width = mainControl.Width + windowBorderSize; configWindow.Height = mainControl.Height + windowHeaderSize; configWindow.Title = windowTitle; configWindow.Closing += (s, e) => closingHandler(s, e); configWindow.Owner = Application.Current.MainWindow; configWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; Application.Current.MainWindow.Closing += Application_Closing; Windows.Add(xamlFileName, configWindow); return(configWindow); } catch (Exception ex) { Logger.Debug("Failed to load Config UI {0}", ex); } return(null); }
public ConfigData(string file) { this.file = file; this.settings = XmlSettings<ConfigData>.Bind(this, file); }
void Start() { genderWidth = skin.label.fixedWidth + (2 * skin.toggle.fixedWidth) + (2 * genderButton) + 15.0f; settings = SettingsSerializer.Instance.ReadSettings (); male = (PlayerSettings.Instance.Gender == (int)XmlSettings.Genders.Male); messageEnd = "\n-PLEASE TRY AGAIN-"; }
public Configuration(string currentConfig, bool setcurrentconfig, bool createTemp, LoadParameterInfo loadParams) { #region init variables CustomViews = new MFview(); CurrentView = string.Empty; DbSelection = new string[] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty }; ListSeparator = new string[] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty }; RoleSeparator = new string[] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty }; StrGlobalFilterString = string.Empty; WStrSortSensCount = string.Empty; WStrSortSens = string.Empty; TitleDelim = string.Empty; StrPlayedRow = null; StrSuppressPlayed = string.Empty; MovieList = new List<string[]>(); TrailerList = new List<string[]>(); MyFilmsPlaybackActive = false; StrArtist = false; BoolMenuShowAll = false; IsDbReloadRequired = false; BoolSortCountinViews = false; BoolDontSplitValuesInViews = false; BoolSkipViewState = false; MenuSelectedId = -1; BoolEnableOnlineServices = false; #endregion #region Load Config Parameters in MyFilms.xml file (section currentConfig) //LogMyFilms.Debug("MFC: Configuration loading started for '" + CurrentConfig + "'"); //if (setcurrentconfig) //{ // XmlConfig xmlConfigSave = new XmlConfig(); // xmlConfigSave.WriteXmlConfig("MyFilms", "MyFilms", "Current_Config", CurrentConfig); // // the xmlwriter caused late update on the file when leaving MP, thus overwriting MyFilms.xml and moving changes to MyFilms.bak !!! -> We write directly only! // //using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MyFilms.xml"))) // //{ // // xmlwriter.SetValue("MyFilms", "Current_Config", CurrentConfig); // // xmlwriter.Dispose(); // //} // //using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MyFilms.xml"))) //} using (var xmlConfig = new XmlSettings(Config.GetFile(Config.Dir.Config, "MyFilms.xml"), true)) // true = cached ! { if (setcurrentconfig) { xmlConfig.WriteXmlConfig("MyFilms", "MyFilms", "Current_Config", currentConfig); // XmlSettings.SaveCache(); // ToDo: Debug, if it is required here ! } #region read xml data AlwaysShowConfigMenu = xmlConfig.ReadXmlConfig("MyFilms", "MyFilms", "Menu_Config", false); StrStorage = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntStorage", string.Empty); StrDirStor = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "PathStorage", string.Empty); StrStorageTrailer = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntStorageTrailer", string.Empty); StrDirStorTrailer = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "PathStorageTrailer", string.Empty); StrDirStorActorThumbs = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "PathStorageActorThumbs", string.Empty); SearchFile = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "SearchFileName", "False"); SearchFileTrailer = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "SearchFileNameTrailer", false); ItemSearchFile = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ItemSearchFileName", string.Empty); ItemSearchGrabber = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ItemSearchGrabberName", string.Empty); ItemSearchGrabberScriptsFilter = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ItemSearchGrabberScriptsFilter", string.Empty); GrabberOverrideLanguage = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "GrabberOverrideLanguage", string.Empty); GrabberOverridePersonLimit = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "GrabberOverridePersonLimit", string.Empty); GrabberOverrideTitleLimit = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "GrabberOverrideTitleLimit", string.Empty); GrabberOverrideGetRoles = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "GrabberOverrideGetRoles", string.Empty); PictureHandling = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "PictureHandling", string.Empty); ItemSearchFileTrailer = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ItemSearchFileNameTrailer", string.Empty); SearchSubDirs = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "SearchSubDirs", false); SearchOnlyExactMatches = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "SearchOnlyExactMatches", false); AutoRegisterTrailer = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "TrailerAutoregister", false); CacheOnlineTrailer = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "CacheOnlineTrailer", false); CheckWatched = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "CheckWatched", false); CheckWatchedPlayerStopped = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "CheckWatchedPlayerStopped", false); StrIdentItem = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntIdentItem", string.Empty); StrTitle1 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntTitle1", string.Empty); StrTitle2 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntTitle2", string.Empty); StrSTitle = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntSTitle", string.Empty); if (StrSTitle == string.Empty) StrSTitle = StrTitle1; StrViewDfltItem = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ViewDfltItem", string.Empty); if (loadParams != null && !string.IsNullOrEmpty(loadParams.View)) StrViewDfltItem = loadParams.View; StrViewDfltText = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ViewDfltText", string.Empty); if (loadParams != null && !string.IsNullOrEmpty(loadParams.ViewValue)) StrViewDfltText = loadParams.ViewValue; CustomViews.View.Clear(); int iCustomViews = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntViewTotalCount", -1); #region New Customviews not yet present - add them ... if (iCustomViews == -1) { MFview.ViewRow newRow = CustomViews.View.NewViewRow(); //Films (mastertitle) newRow.DBfield = StrTitle1; newRow.Label = GUILocalizeStrings.Get(342); // videos newRow.Value = "*"; newRow.ImagePath = MyFilmsSettings.GetPath(MyFilmsSettings.Path.DefaultImages) + @"\Films.jpg"; CustomViews.View.Rows.Add(newRow); //year newRow = CustomViews.View.NewViewRow(); newRow.DBfield = "Year"; newRow.SortDirectionView = " DESC"; newRow.Label = BaseMesFilms.TranslateColumn(newRow.DBfield); newRow.ImagePath = MyFilmsSettings.GetPath(MyFilmsSettings.Path.DefaultImages) + @"\Year.jpg"; CustomViews.View.Rows.Add(newRow); //Category newRow = CustomViews.View.NewViewRow(); newRow.DBfield = "Category"; newRow.Label = BaseMesFilms.TranslateColumn(newRow.DBfield); newRow.ImagePath = MyFilmsSettings.GetPath(MyFilmsSettings.Path.DefaultImages) + @"\Category.jpg"; CustomViews.View.Rows.Add(newRow); //Country newRow = CustomViews.View.NewViewRow(); newRow.DBfield = "Country"; newRow.Label = BaseMesFilms.TranslateColumn(newRow.DBfield); newRow.ImagePath = MyFilmsSettings.GetPath(MyFilmsSettings.Path.DefaultImages) + @"\Country.jpg"; CustomViews.View.Rows.Add(newRow); //RecentlyAdded newRow = CustomViews.View.NewViewRow(); newRow.DBfield = "RecentlyAdded"; newRow.Label = BaseMesFilms.TranslateColumn(newRow.DBfield); newRow.ImagePath = MyFilmsSettings.GetPath(MyFilmsSettings.Path.DefaultImages) + @"\RecentlyAdded.jpg"; CustomViews.View.Rows.Add(newRow); //Indexed title view newRow = CustomViews.View.NewViewRow(); newRow.DBfield = StrTitle1; newRow.Label = BaseMesFilms.TranslateColumn(newRow.DBfield); newRow.Index = 1; newRow.Value = "*"; newRow.ImagePath = MyFilmsSettings.GetPath(MyFilmsSettings.Path.DefaultImages) + @"\TitlesIndex.jpg"; CustomViews.View.Rows.Add(newRow); //Box Sets view (mastertitle) newRow = CustomViews.View.NewViewRow(); newRow.DBfield = StrTitle1; newRow.Label = "Box Sets"; newRow.Value = "*"; newRow.Filter = @"(" + StrTitle1 + @" like '*\*') "; newRow.ImagePath = MyFilmsSettings.GetPath(MyFilmsSettings.Path.DefaultImages) + @"\Films.jpg"; CustomViews.View.Rows.Add(newRow); //Actors newRow = CustomViews.View.NewViewRow(); newRow.DBfield = "Actors"; newRow.Index = 1; newRow.Label = BaseMesFilms.TranslateColumn(newRow.DBfield); newRow.ImagePath = MyFilmsSettings.GetPath(MyFilmsSettings.Path.DefaultImages) + @"\PersonsIndex.jpg"; CustomViews.View.Rows.Add(newRow); //Producer newRow = CustomViews.View.NewViewRow(); newRow.DBfield = "Producer"; newRow.Label = BaseMesFilms.TranslateColumn(newRow.DBfield); newRow.ImagePath = MyFilmsSettings.GetPath(MyFilmsSettings.Path.DefaultImages) + @"\Persons.jpg"; CustomViews.View.Rows.Add(newRow); iCustomViews = 5; // to load "old Custom Views" } #endregion #region load customviews from config int index = 1; for (int i = 1; i < iCustomViews + 1; i++) { if (string.IsNullOrEmpty(xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntViewText" + index, string.Empty))) break; MFview.ViewRow view = CustomViews.View.NewViewRow(); view.Label = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, string.Format("AntViewText{0}", index), string.Empty); // view.Label2 = XmlConfig.ReadXmlConfig("MyFilms", CurrentConfig, string.Format("AntViewLabel2{0}", index), string.Empty); // cached counts, if available view.ViewEnabled = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, string.Format("AntViewEnabled{0}", index), true); view.ImagePath = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, string.Format("AntViewImagePath{0}", index), string.Empty); view.DBfield = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, string.Format("AntViewItem{0}", index), string.Empty); view.Value = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, string.Format("AntViewValue{0}", index), string.Empty); view.Filter = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, string.Format("AntViewFilter{0}", index), string.Empty); view.Index = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, string.Format("AntViewIndex{0}", index), 0); view.SortFieldViewType = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, string.Format("AntViewSortFieldViewType{0}", index), "Name"); view.SortDirectionView = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, string.Format("AntViewSortDirectionView{0}", index), " ASC"); view.SortDirectionView = view.SortDirectionView.Contains("ASC") ? " ASC" : " DESC"; view.LayoutView = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, string.Format("AntViewLayoutView{0}", index), "0"); // LogMyFilms.Debug("Adding view - #: '" + index + "', DBitem: '" + view.DBfield + "', View Label: '" + view.Label + "'"); if (view.DBfield.Length > 0) CustomViews.View.AddViewRow(view); index++; } #endregion StrFileXml = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntCatalog", string.Empty); StrFileXmlTemp = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntCatalogTemp", string.Empty); StrFileType = (CatalogType)int.Parse(xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "CatalogType", "0")); StrPathImg = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntPicture", string.Empty); StrArtistDflt = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ArtistDflt", false); StrPathFanart = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "FanartPicture", string.Empty); StrPathViews = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ViewsPicture", string.Empty); StrPathArtist = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ArtistPicturePath", string.Empty); #region user defined display items Stritem1 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntItem1", string.Empty); Stritem2 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntItem2", string.Empty); Stritem3 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntItem3", string.Empty); Stritem4 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntItem4", string.Empty); Stritem5 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntItem5", string.Empty); Strlabel1 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntLabel1", string.Empty); Strlabel2 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntLabel2", string.Empty); Strlabel3 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntLabel3", string.Empty); Strlabel4 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntLabel4", string.Empty); Strlabel5 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntLabel5", string.Empty); StritemDetails1 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntItemDetails1", "Category"); StritemDetails2 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntItemDetails2", "Country"); StritemDetails3 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntItemDetails3", "Director"); StritemDetails4 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntItemDetails4", "Producer"); StritemDetails5 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntItemDetails5", "Languages"); StritemDetails6 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntItemDetails6", "Date"); StrlabelDetails1 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntLabelDetails1", BaseMesFilms.TranslateColumn(StritemDetails1)); StrlabelDetails2 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntLabelDetails2", BaseMesFilms.TranslateColumn(StritemDetails2)); StrlabelDetails3 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntLabelDetails3", BaseMesFilms.TranslateColumn(StritemDetails3)); StrlabelDetails4 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntLabelDetails4", BaseMesFilms.TranslateColumn(StritemDetails4)); StrlabelDetails5 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntLabelDetails5", BaseMesFilms.TranslateColumn(StritemDetails5)); StrlabelDetails6 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntLabelDetails6", BaseMesFilms.TranslateColumn(StritemDetails6)); #endregion StrIdentLabel = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntIdentLabel", string.Empty); StrLogos = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "Logos", false); StrSuppressAutomatic = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "Suppress", false); StrSuppressManual = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "SuppressManual", false); StrSuppressPlayStopUpdateUserField = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "SuppressPlayed", false); StrSuppressAutomaticActionType = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "SuppressType", string.Empty); StrWatchedField = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "WatchedField", "Checked"); // Defaults to "Checked", if no value set, as it's most used in ANT like that StrSuppressField = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "SuppressField", string.Empty); StrSuppressValue = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "SuppressValue", string.Empty); EnhancedWatchedStatusHandling = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "EnhancedWatchedStatusHandling", false) || StrFileType == CatalogType.AntMovieCatalog4Xtended; // always force MUS/EWS on AMC4 Catalog types StrUserProfileName = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "UserProfileName", MyFilms.DefaultUsername); // MyFilms.DefaultUsername StrECoptionStoreTaglineInDescription = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ECoptionStoreTaglineInDescription", false); #region Common EC options bool addTagline = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ECoptionAddTagline", false); bool addTags = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ECoptionAddTags", false); bool addCertification = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ECoptionAddCertification", false); bool addWriter = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ECoptionAddWriter", false); string destinationTagline = ""; string destinationTags = ""; string destinationCertification = ""; string destinationWriter = ""; if (IsExternalCatalog(StrFileType)) { destinationTagline = addTagline ? xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ECoptionAddDestinationTagline", "") : ""; destinationTags = addTags ? xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ECoptionAddDestinationTags", "") : ""; destinationCertification = addCertification ? xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ECoptionAddDestinationCertification", "") : ""; destinationWriter = addWriter ? xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ECoptionAddDestinationWriter", "") : ""; } // LogMyFilms.Debug("MFC: switch (StrFileType) '" + StrFileType.ToString() + "'"); #endregion ReadOnly = IsExternalCatalog(StrFileType); #region Catalog Specific Settings ... switch (StrFileType) { case CatalogType.AntMovieCatalog3: case CatalogType.AntMovieCatalog4Xtended: break; case CatalogType.DVDProfiler: if (createTemp) { string WStrPath = System.IO.Path.GetDirectoryName(StrFileXml); string destFile = WStrPath + "\\" + StrFileXml.Substring(StrFileXml.LastIndexOf(@"\") + 1, StrFileXml.Length - StrFileXml.LastIndexOf(@"\") - 5) + "_tmp.xml"; if ((System.IO.File.Exists(destFile) && (System.IO.File.GetLastWriteTime(destFile) > System.IO.File.GetLastWriteTime(StrFileXml)))) { StrFileXml = destFile; break; } bool OnlyFile = false; OnlyFile = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "OnlyFile", false); string TagField = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "DVDPTagField", string.Empty); DvdProfiler cv = new DvdProfiler(TagField); StrFileXml = cv.ConvertProfiler(StrFileXml, StrPathImg, destinationTagline, destinationTags, destinationCertification, destinationWriter, TagField, OnlyFile); } else StrFileXml = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntCatalogTemp", string.Empty); break; case CatalogType.MovieCollector: if (createTemp) { string WStrPath = System.IO.Path.GetDirectoryName(StrFileXml); string destFile = WStrPath + "\\" + StrFileXml.Substring(StrFileXml.LastIndexOf(@"\") + 1, StrFileXml.Length - StrFileXml.LastIndexOf(@"\") - 5) + "_tmp.xml"; if ((System.IO.File.Exists(destFile) && (System.IO.File.GetLastWriteTime(destFile) > System.IO.File.GetLastWriteTime(StrFileXml)))) { StrFileXml = destFile; break; } bool OnlyFile = false; OnlyFile = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "OnlyFile", false); MovieCollector mc = new MovieCollector(); StrFileXml = mc.ConvertMovieCollector(StrFileXml, StrPathImg, destinationTagline, destinationTags, destinationCertification, destinationWriter, OnlyFile, TitleDelim); } else StrFileXml = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntCatalogTemp", string.Empty); break; case CatalogType.MyMovies: if (createTemp) { string WStrPath = System.IO.Path.GetDirectoryName(StrFileXml); string destFile = WStrPath + "\\" + StrFileXml.Substring(StrFileXml.LastIndexOf(@"\") + 1, StrFileXml.Length - StrFileXml.LastIndexOf(@"\") - 5) + "_tmp.xml"; if ((System.IO.File.Exists(destFile) && (System.IO.File.GetLastWriteTime(destFile) > System.IO.File.GetLastWriteTime(StrFileXml)))) { StrFileXml = destFile; break; } bool OnlyFile = false; OnlyFile = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "OnlyFile", false); MyMovies mm = new MyMovies(); StrFileXml = mm.ConvertMyMovies(StrFileXml, StrPathImg, destinationTagline, destinationTags, destinationCertification, destinationWriter, OnlyFile); } else StrFileXml = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntCatalogTemp", string.Empty); break; case CatalogType.EaxMovieCatalog2: if (createTemp) { string WStrPath = System.IO.Path.GetDirectoryName(StrFileXml); string destFile = WStrPath + "\\" + StrFileXml.Substring(StrFileXml.LastIndexOf(@"\") + 1, StrFileXml.Length - StrFileXml.LastIndexOf(@"\") - 5) + "_tmp.xml"; if ((System.IO.File.Exists(destFile) && (System.IO.File.GetLastWriteTime(destFile) > System.IO.File.GetLastWriteTime(StrFileXml)))) { StrFileXml = destFile; break; } bool OnlyFile = false; OnlyFile = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "OnlyFile", false); EaxMovieCatalog emc = new EaxMovieCatalog(); StrFileXml = emc.ConvertEaxMovieCatalog(StrFileXml, StrPathImg, destinationTagline, destinationTags, destinationCertification, destinationWriter, OnlyFile, TitleDelim); } else StrFileXml = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntCatalogTemp", string.Empty); break; case CatalogType.EaxMovieCatalog3: if (createTemp) { string WStrPath = System.IO.Path.GetDirectoryName(StrFileXml); string destFile = WStrPath + "\\" + StrFileXml.Substring(StrFileXml.LastIndexOf(@"\") + 1, StrFileXml.Length - StrFileXml.LastIndexOf(@"\") - 5) + "_tmp.xml"; if ((System.IO.File.Exists(destFile) && (System.IO.File.GetLastWriteTime(destFile) > System.IO.File.GetLastWriteTime(StrFileXml)))) { StrFileXml = destFile; break; } bool OnlyFile = false; OnlyFile = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "OnlyFile", false); EaxMovieCatalog3 emc3 = new EaxMovieCatalog3(); StrFileXml = emc3.ConvertEaxMovieCatalog3(StrFileXml, StrPathImg, destinationTagline, destinationTags, destinationCertification, destinationWriter, OnlyFile, TitleDelim); } else StrFileXml = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntCatalogTemp", string.Empty); break; case CatalogType.PersonalVideoDatabase: if (createTemp) { string WStrPath = System.IO.Path.GetDirectoryName(StrFileXml); string destFile = WStrPath + "\\" + StrFileXml.Substring(StrFileXml.LastIndexOf(@"\") + 1, StrFileXml.Length - StrFileXml.LastIndexOf(@"\") - 5) + "_tmp.xml"; if ((System.IO.File.Exists(destFile) && (System.IO.File.GetLastWriteTime(destFile) > System.IO.File.GetLastWriteTime(StrFileXml)))) { StrFileXml = destFile; break; } bool OnlyFile = false; OnlyFile = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "OnlyFile", false); PersonalVideoDatabase pvd = new PersonalVideoDatabase(); StrFileXml = pvd.ConvertPersonalVideoDatabase(StrFileXml, StrPathImg, destinationTagline, destinationTags, destinationCertification, destinationWriter, OnlyFile, TitleDelim, StrECoptionStoreTaglineInDescription); } else StrFileXml = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntCatalogTemp", string.Empty); break; case CatalogType.eXtremeMovieManager: if (createTemp) { string WStrPath = System.IO.Path.GetDirectoryName(StrFileXml); string destFile = WStrPath + "\\" + StrFileXml.Substring(StrFileXml.LastIndexOf(@"\") + 1, StrFileXml.Length - StrFileXml.LastIndexOf(@"\") - 5) + "_tmp.xml"; if ((System.IO.File.Exists(destFile) && (System.IO.File.GetLastWriteTime(destFile) > System.IO.File.GetLastWriteTime(StrFileXml)))) { StrFileXml = destFile; break; } bool OnlyFile = false; OnlyFile = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "OnlyFile", false); XMM xmm = new XMM(); StrFileXml = xmm.ConvertXMM(StrFileXml, StrPathImg, destinationTagline, destinationTags, destinationCertification, destinationWriter, OnlyFile); } else StrFileXml = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntCatalogTemp", string.Empty); break; case CatalogType.XBMC: // XBMC fulldb export (all movies in one DB) if (createTemp) { string WStrPath = System.IO.Path.GetDirectoryName(StrFileXml); string destFile = WStrPath + "\\" + StrFileXml.Substring(StrFileXml.LastIndexOf(@"\") + 1, StrFileXml.Length - StrFileXml.LastIndexOf(@"\") - 5) + "_tmp.xml"; if ((System.IO.File.Exists(destFile) && (System.IO.File.GetLastWriteTime(destFile) > System.IO.File.GetLastWriteTime(StrFileXml)))) { StrFileXml = destFile; break; } bool OnlyFile = false; OnlyFile = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "OnlyFile", false); XbmcNfo nfo = new XbmcNfo(); StrFileXml = nfo.ConvertXbmcNfo(StrFileXml, StrPathImg, destinationTagline, destinationTags, destinationCertification, destinationWriter, StrStorage, OnlyFile, TitleDelim); } else StrFileXml = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntCatalogTemp", string.Empty); break; case CatalogType.MovingPicturesXML: if (createTemp) { string WStrPath = System.IO.Path.GetDirectoryName(StrFileXml); string destFile = WStrPath + "\\" + StrFileXml.Substring(StrFileXml.LastIndexOf(@"\") + 1, StrFileXml.Length - StrFileXml.LastIndexOf(@"\") - 5) + "_tmp.xml"; if ((System.IO.File.Exists(destFile) && (System.IO.File.GetLastWriteTime(destFile) > System.IO.File.GetLastWriteTime(StrFileXml)))) { StrFileXml = destFile; break; } bool OnlyFile = false; OnlyFile = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "OnlyFile", false); MovingPicturesXML mopi = new MovingPicturesXML(); StrFileXml = mopi.ConvertMovingPicturesXML(StrFileXml, StrPathImg, destinationTagline, destinationTags, destinationCertification, destinationWriter, OnlyFile); } else StrFileXml = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntCatalogTemp", string.Empty); break; case CatalogType.XBMCnfoReader: break; //case CatalogType.MediaBrowser3: // if (createTemp) // { // string WStrPath = System.IO.Path.GetDirectoryName(StrFileXml); // string destFile = WStrPath + "\\" + StrFileXml.Substring(StrFileXml.LastIndexOf(@"\") + 1, StrFileXml.Length - StrFileXml.LastIndexOf(@"\") - 5) + "_tmp.xml"; // if ((System.IO.File.Exists(destFile) && (System.IO.File.GetLastWriteTime(destFile) > System.IO.File.GetLastWriteTime(StrFileXml)))) // { // StrFileXml = destFile; // break; // } // bool OnlyFile = false; // OnlyFile = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "OnlyFile", false); // var mb3 = new Mediabrowser(); // StrFileXml = mb3.ConvertMediabrowser(StrFileXml, StrPathImg, destinationTagline, destinationTags, destinationCertification, destinationWriter); // } // else // StrFileXml = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntCatalogTemp", string.Empty); // break; } #endregion StrSelect = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "StrSelect", string.Empty); StrPersons = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "StrPersons", string.Empty); StrTitleSelect = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "StrTitleSelect", string.Empty); StrFilmSelect = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "StrFilmSelect", string.Empty); StrDfltSelect = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "StrDfltSelect", string.Empty); StrViewSelect = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "StrViewSelect", string.Empty); #region experimental Viewmanager settings //StartView.InitDefaults(); //CurrentView.InitDefaults(); ////ViewManager.CurrentSettings.FilmsSortItem = XmlConfig.ReadXmlConfig("MyFilms", CurrentConfig, "StrSort", string.Empty); //CurrentView.FilmsSortItem = XmlConfig.ReadXmlConfig("MyFilms", CurrentConfig, "StrSort", string.Empty); //CurrentView.FilmsSortDirection = XmlConfig.ReadXmlConfig("MyFilms", CurrentConfig, "StrSortSens", string.Empty); //CurrentView.HierarchySortItem = XmlConfig.ReadXmlConfig("MyFilms", CurrentConfig, "StrSortInHierarchies", string.Empty); //CurrentView.HierarchySortDirection = XmlConfig.ReadXmlConfig("MyFilms", CurrentConfig, "StrSortSensInHierarchies", string.Empty); //StartView.FilmsSortItem = XmlConfig.ReadXmlConfig("MyFilms", CurrentConfig, "AntDfltStrSort", string.Empty); //StartView.FilmsSortDirection = XmlConfig.ReadXmlConfig("MyFilms", CurrentConfig, "AntDfltStrSortSens", string.Empty); //StartView.HierarchySortItem = XmlConfig.ReadXmlConfig("MyFilms", CurrentConfig, "AntDfltStrSortInHierarchies", string.Empty); // InHierarchies //StartView.HierarchySortItemFriendlyName = XmlConfig.ReadXmlConfig("MyFilms", CurrentConfig, "AntDfltStrSortSensInHierarchies", string.Empty); //string startview = XmlConfig.ReadXmlConfig("MyFilms", CurrentConfig, "CurrentView", string.Empty); //if (!string.IsNullOrEmpty(startview)) StartView.LoadFromString(startview); #endregion ViewContext = (MyFilms.ViewContext)Enum.Parse(typeof(MyFilms.ViewContext), xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ViewContext", Enum.GetName(typeof(MyFilms.ViewContext), MyFilms.ViewContext.None))); StrTxtView = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "View", string.Empty); StrTxtSelect = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "Selection", string.Empty); try { StrIndex = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "IndexItem", -1); } catch { StrIndex = -1; } StrTIndex = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "TitleItem", string.Empty); Boolselect = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "Boolselect", false); Boolreturn = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "Boolreturn", false); Boolindexed = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "Boolindexed", false); Boolindexedreturn = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "Boolindexedreturn", false); IndexedChars = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "IndexedChars", 0); BoolReverseNames = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ReversePersonNames", false); BoolVirtualPathBrowsing = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "VirtualPathBrowsing", false); BoolAskForPlaybackQuality = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AskForPlaybackQuality", false); WStrSort = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "WStrSort", string.Empty); Wselectedlabel = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "WSelectedLabel", string.Empty); Wstar = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "Wstar", string.Empty); LastID = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "LastID", -1); TitleDelim = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "TitleDelim", "."); DefaultCover = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "DefaultCover", string.Empty); DefaultCoverArtist = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "DefaultCoverArtist", string.Empty); DefaultCoverViews = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "DefaultCoverViews", string.Empty); DefaultFanartImage = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "DefaultFanartImage", string.Empty); StrAntFilterMinRating = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntFilterMinRating", "5"); StrGrabber_cnf = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "Grabber_cnf", string.Empty); StrPicturePrefix = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "PicturePrefix", string.Empty); StrGrabber_Always = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "Grabber_Always", false); StrGrabber_ChooseScript = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "Grabber_ChooseScript", false); StrAMCUpd = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AMCUpd", false); AMCUscanOnStartup = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AMCUscanOnStartup", false); AMCUwatchScanFolders = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AMCUwatchScanFolders", false); AMCUscanStartDelay = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AMCUscanStartDelay", 60); StrAMCUpd_cnf = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AMCUpd_cnf", string.Empty); StrFanart = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "Fanart", false); StrFanartDefaultViews = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "FanartDefaultViews", false); StrFanartDefaultViewsUseRandom = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "FanartDefaultViewsUseRandom", false); StrFanartDflt = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "FanartDflt", false); StrFanartDfltImage = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "FanartDfltImage", false); StrFanartDfltImageAll = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "FanartDfltImageAll", false); UseThumbsForViews = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "Views", false); UseThumbsForPersons = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "Persons", false); PersonsEnableDownloads = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "PersonsEnableDownloads", false); StrViewsDflt = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ViewsDflt", false); StrViewsDfltAll = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ViewsDfltAll", false); StrViewsShowIndexedImgInIndViews = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ViewsShowIndexedImages", false); #region WOL settings StrCheckWOLenable = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "WOL-Enable", false); StrWOLtimeout = Convert.ToInt16(xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "WOL-Timeout", "15")); StrCheckWOLuserdialog = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "WOL-Userdialog", false); StrNasName1 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "NAS-Name-1", string.Empty); StrNasMAC1 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "NAS-MAC-1", string.Empty); StrNasName2 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "NAS-Name-2", string.Empty); StrNasMAC2 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "NAS-MAC-2", string.Empty); StrNasName3 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "NAS-Name-3", string.Empty); StrNasMAC3 = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "NAS-MAC-3", string.Empty); #endregion #region external player ExternalPlayerPath = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ExternalPlayerPath", string.Empty); ExternalPlayerStartParams = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ExternalPlayerStartParams", string.Empty); ExternalPlayerExtensions = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ExternalPlayerExtensions", string.Empty); #endregion #region read states vars for each possible view - do we also need states for "userdefined views"? (disabled) //DataBase.AntMovieCatalog ds = new DataBase.AntMovieCatalog(); //MyFilms.ViewStateCache.Clear(); //foreach (DataColumn dc in ds.Movie.Columns) //{ // ViewState tView = new ViewState(); // string viewstateName = "ViewState-" + dc.ColumnName; // string viewstate = XmlConfig.ReadXmlConfig("MyFilms", CurrentConfig, viewstateName, string.Empty); // if (!string.IsNullOrEmpty(viewstate)) // { // tView.LoadFromString(viewstate); // MyFilms.ViewStateCache.Add(dc.ColumnName, tView); // } // //else // //{ // // tView.ViewDBItem = dc.ColumnName; // // CustomView.Add(tView); // //} //} #endregion #region search history StrSearchHistory = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "SearchHistory", string.Empty); MyFilms.SearchHistory.Clear(); foreach (string s in this.StrSearchHistory.Split('|').Where(s => !string.IsNullOrEmpty(s.Trim()))) { MyFilms.SearchHistory.Add(s); } #endregion #region list and role separators int j = 0; for (int i = 1; i <= 5; i++) { if (xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ListSeparator" + i, string.Empty).Length > 0) { this.ListSeparator[j] = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ListSeparator" + i, string.Empty).Replace("#LF#", "\n"); // support for new line separation j++; } } j = 0; for (int i = 1; i <= 5; i++) { if (xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "RoleSeparator" + i, string.Empty).Length > 0) { RoleSeparator[j] = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "RoleSeparator" + i, string.Empty); j++; } } #endregion CmdPar = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "CmdPar", string.Empty); if (CmdPar == "(none)") CmdPar = ""; OnlyTitleList = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "OnlyTitleList", false); GlobalAvailableOnly = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "GlobalAvailableOnly", false); GlobalUnwatchedOnly = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "GlobalUnwatchedOnly", false); GlobalUnwatchedOnlyValue = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "GlobalUnwatchedOnlyValue", "false"); ScanMediaOnStart = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "CheckMediaOnStart", false); BoolShowEmptyValuesInViews = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "ShowEmpty", false); AllowTraktSync = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AllowTraktSync", false); AllowRecentlyAddedApi = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AllowRecentAddedAPI", false); #region layout settings StrLayOut = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "LayOut", 0); StrLayOutInHierarchies = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "LayOutInHierarchies", StrLayOut); WStrLayOut = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "WLayOut", StrLayOut); int iDfltLayOut = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntDfltLayOut", 0); int iDfltLayOutInHierarchies = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntDfltLayOutInHierarchies", 0); if (loadParams != null && !string.IsNullOrEmpty(loadParams.Layout)) { #region override layout with start params, if available int iLayout = 0; if (int.TryParse(loadParams.Layout, out iLayout)) if (iLayout >= 0 && iLayout <= 4) { StrLayOut = iLayout; WStrLayOut = iLayout; StrLayOutInHierarchies = iLayout; } #endregion } #endregion #region Sort Settings StrSorta = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "StrSort", string.Empty); StrSortSens = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "StrSortSens", string.Empty); StrSortaInHierarchies = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "StrSortInHierarchies", string.Empty); StrSortSensInHierarchies = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "StrSortSensInHierarchies", string.Empty); string wDfltSort = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntDfltStrSort", string.Empty); string wDfltSortSens = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntDfltStrSortSens", string.Empty); string wDfltSortInHierarchies = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntDfltStrSortInHierarchies", string.Empty); // InHierarchies string wDfltSortSensInHierarchies = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AntDfltStrSortSensInHierarchies", string.Empty); #endregion AlwaysDefaultView = xmlConfig.ReadXmlConfig("MyFilms", currentConfig, "AlwaysDefaultView", false); if (AlwaysDefaultView || MyFilms.InitialStart || (loadParams != null && (!string.IsNullOrEmpty(loadParams.View) || !string.IsNullOrEmpty(loadParams.MovieID)))) { #region overrides for "AlwaysDefaultView" ViewContext = MyFilms.ViewContext.StartView; StrIndex = -1; LastID = -1; Wstar = ""; Boolreturn = false; Boolselect = true; Boolindexed = false; Boolindexedreturn = false; Wselectedlabel = StrViewDfltText; if (loadParams == null || string.IsNullOrEmpty(loadParams.Layout)) { StrLayOut = iDfltLayOut; StrLayOutInHierarchies = iDfltLayOutInHierarchies; WStrLayOut = iDfltLayOut; // also preset views layout to default - although it most probably will be overridden by views setting } if (Helper.FieldIsSet(wDfltSort)) { StrSorta = wDfltSort; StrSortSens = wDfltSortSens; } if (Helper.FieldIsSet(wDfltSortInHierarchies)) // hierarchies sort settings { StrSortaInHierarchies = wDfltSortInHierarchies; StrSortSensInHierarchies = wDfltSortSensInHierarchies; } #endregion } xmlConfig.Dispose(); #endregion } #endregion #region check and correct settings // if (string.IsNullOrEmpty(StrSelect)) StrSelect = StrTitle1 + " not like ''"; if (string.IsNullOrEmpty(StrSorta)) StrSorta = StrSTitle; if (string.IsNullOrEmpty(StrSortaInHierarchies)) StrSortaInHierarchies = StrSTitle; // ToDo: Remove Migration Code if (StrSorta == "DateAdded") StrSorta = "Date"; if (StrSortaInHierarchies == "DateAdded") StrSortaInHierarchies = "Date"; if (string.IsNullOrEmpty(StrSortSens) || StrSortSens == "ASC") StrSortSens = " ASC"; if (StrSortSens == "DESC") StrSortSens = " DESC"; if (string.IsNullOrEmpty(StrSortSensInHierarchies) || StrSortSensInHierarchies == "ASC") StrSortSensInHierarchies = " ASC"; if (StrSortSensInHierarchies == "DESC") StrSortSensInHierarchies = " DESC"; if (string.IsNullOrEmpty(WStrSortSens) || WStrSortSens == "ASC") WStrSortSens = " ASC"; if (WStrSortSens == "DESC") WStrSortSens = " DESC"; if (string.IsNullOrEmpty(WStrSortSensCount) || WStrSortSensCount == "DESC") WStrSortSensCount = " DESC"; if (WStrSortSensCount == "ASC") WStrSortSensCount = " ASC"; if (StrFanart) if (!(StrPathFanart.Length > 0 && System.IO.Directory.Exists(StrPathFanart))) { LogMyFilms.Info("MyFilms : Fanart Path '" + StrPathFanart + "', doesn't exist. Fanart disabled ! "); StrFanart = false; } if (StrArtist) if (!(StrPathArtist.Length > 0 && System.IO.Directory.Exists(StrPathArtist))) { LogMyFilms.Info("MyFilms : Artist Path '" + StrPathArtist + "', doesn't exist. Artist Pictures disabled ! "); StrArtist = false; } #endregion // LogMyFilms.Debug("MFC: Configuration loading ended for '" + CurrentConfig + "'"); }
public ConfigData(string file) { this.file = file; this.settings = XmlSettings <ConfigData> .Bind(this, file); }
public static void saveSettings(string filename) { TricksterTools.Library.Xml.Settings.XmlTricksterRoot XmlRoot = new TricksterTools.Library.Xml.Settings.XmlTricksterRoot(); XmlTools Tools = new XmlTools(); XmlSettings Settings = new XmlSettings(); XmlSettingHungUpTime hungtime = new XmlSettingHungUpTime(); XmlSettingUpdate update = new XmlSettingUpdate(); XmlSettingGameStartUp gamestartup = new XmlSettingGameStartUp(); XmlSettingLogging logging = new XmlSettingLogging(); XmlSettingIcons icons = new XmlSettingIcons(); hungtime.enable = (HungUp.enable) ? "true" : "false"; hungtime.sec = HungUp.sec; update.startup = (Update.startupAutoCehck) ? "true" : "false"; update.checkBeta = (Update.checkBetaVersion) ? "true" : "false"; gamestartup.mode = GameStartUp.mode; logging.enable = (Logging.enable) ? "true" : "false"; logging.Path = Logging.filePath; icons.resourceName = Icons.resourceName; Settings.HungupTime = hungtime; Settings.UpdateCheck = update; Settings.StartUpGame = gamestartup; //Settings.Logging = logging; Settings.Icon = icons; Tools.Settings = Settings; XmlRoot.Tools = Tools; string filepath = ""; if (Path.IsPathRooted(filename)) { filepath = filename; filename = Path.GetFileName(filename); } else { filepath = Path.GetFullPath(Environment.CurrentDirectory + @"\" + filename); } if (!File.Exists(filepath)) { // �t�@�C�����Ȃ���쐬 FileStream fs = new FileStream(filepath, FileMode.Create); fs.Close(); } try { System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(TricksterTools.Library.Xml.Settings.XmlTricksterRoot)); FileStream fs = new FileStream(filepath, FileMode.Create); serializer.Serialize(fs, XmlRoot); fs.Close(); } catch (System.Security.SecurityException se) { SimpleLogger.WriteLine(se.Message); //MessageBox.Show("��O�G���[:" + Environment.NewLine + "�Z�L�����e�B�G���[�ł��B", "SecurityExceptional error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw se; } catch (System.IO.IOException ioe) { SimpleLogger.WriteLine(ioe.Message); //MessageBox.Show("��O�G���[:" + Environment.NewLine + "���o�͎��ɃG���[���������܂����B", "IOExceptional error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw ioe; } catch (System.Xml.XmlException xe) { SimpleLogger.WriteLine(xe.Message); //MessageBox.Show("��O�G���[:" + Environment.NewLine + "�ݒ�ǂݍ��݃G���[", "XmlExceptional error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw xe; } catch (System.Exception e) { SimpleLogger.WriteLine(e.Message); //MessageBox.Show("��O�G���[:" + Environment.NewLine + "�����̓��肪�ł��܂���ł����B", "Exceptional error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw e; } }
public static void saveSettings(string filename) { TricksterTools.Library.Xml.Settings.XmlTricksterRoot XmlRoot = new TricksterTools.Library.Xml.Settings.XmlTricksterRoot(); XmlTools Tools = new XmlTools(); XmlSettings Settings = new XmlSettings(); XmlSettingHungUpTime hungtime = new XmlSettingHungUpTime(); XmlSettingUpdate update = new XmlSettingUpdate(); XmlSettingGameStartUp gamestartup = new XmlSettingGameStartUp(); XmlSettingLogging logging = new XmlSettingLogging(); XmlSettingIcons icons = new XmlSettingIcons(); hungtime.enable = (HungUp.enable) ? "true" : "false"; hungtime.sec = HungUp.sec; update.startup = (Update.startupAutoCehck) ? "true" : "false"; update.checkBeta = (Update.checkBetaVersion) ? "true" : "false"; gamestartup.mode = GameStartUp.mode; logging.enable = (Logging.enable) ? "true" : "false"; logging.Path = Logging.filePath; icons.resourceName = Icons.resourceName; Settings.HungupTime = hungtime; Settings.UpdateCheck = update; Settings.StartUpGame = gamestartup; //Settings.Logging = logging; Settings.Icon = icons; Tools.Settings = Settings; XmlRoot.Tools = Tools; string filepath = ""; if (Path.IsPathRooted(filename)) { filepath = filename; filename = Path.GetFileName(filename); } else { filepath = Path.GetFullPath(Environment.CurrentDirectory + @"\" + filename); } if (!File.Exists(filepath)) { // ファイルがなければ作成 FileStream fs = new FileStream(filepath, FileMode.Create); fs.Close(); } try { System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(TricksterTools.Library.Xml.Settings.XmlTricksterRoot)); FileStream fs = new FileStream(filepath, FileMode.Create); serializer.Serialize(fs, XmlRoot); fs.Close(); } catch (System.Security.SecurityException se) { SimpleLogger.WriteLine(se.Message); //MessageBox.Show("例外エラー:" + Environment.NewLine + "セキュリティエラーです。", "SecurityExceptional error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw se; } catch (System.IO.IOException ioe) { SimpleLogger.WriteLine(ioe.Message); //MessageBox.Show("例外エラー:" + Environment.NewLine + "入出力時にエラーが発生しました。", "IOExceptional error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw ioe; } catch (System.Xml.XmlException xe) { SimpleLogger.WriteLine(xe.Message); //MessageBox.Show("例外エラー:" + Environment.NewLine + "設定読み込みエラー", "XmlExceptional error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw xe; } catch (System.Exception e) { SimpleLogger.WriteLine(e.Message); //MessageBox.Show("例外エラー:" + Environment.NewLine + "原因の特定ができませんでした。", "Exceptional error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw e; } }
/// <summary> /// XML�t�@�C������ݒ��ǂݍ��݁A�N���X��̃v���p�e�B�ɐݒ肷�� /// </summary> /// /// <param name="filename">�ǂݍ���XML�t�@�C����</param> /// <returns>ID��L�[�APasswod��l�Ƃ����n�b�V���e�[�u��</returns> public static void loadSettings(string filename) { string filepath = ""; if (Path.IsPathRooted(filename)) { filepath = filename; filename = Path.GetFileName(filename); } else { filepath = Path.GetFullPath(Environment.CurrentDirectory + @"\" + filename); } if (File.Exists(filepath)) { try { System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(TricksterTools.Library.Xml.Settings.XmlTricksterRoot)); System.IO.FileStream fs = new System.IO.FileStream(filepath, System.IO.FileMode.Open); TricksterTools.Library.Xml.Settings.XmlTricksterRoot XmlRoot = (TricksterTools.Library.Xml.Settings.XmlTricksterRoot)serializer.Deserialize(fs); XmlSettings Tools = new XmlSettings(); if (XmlRoot.Tools.name != "TSLoginManager") { MessageBox.Show("TSLoginManager�ȊO�̐ݒ�t�@�C�����ǂݍ��܂�Ă��܂��B" + Environment.NewLine + "�ݒ�͓ǂݍ��܂�܂���ł����B", "�ݒ�ǂݍ��݃G���[", MessageBoxButtons.OK, MessageBoxIcon.Warning); HungUp.enable = false; HungUp.sec = 60; Update.startupAutoCehck = false; Update.checkBetaVersion = false; GameStartUp.mode = RUN_GAME_DIRECT; //Logging.enable = false; //Logging.fileName = Environment.CurrentDirectory + @"\debug.log"; Icons.resourceName = "char99"; return; } Tools = XmlRoot.Tools.Settings; // Logging�ݒ� /* try { if (Tools.Logging.enable == "true") { Logging.enable = true; } else { Logging.enable = false; } } catch (Exception e) { SimpleLogger.WriteLine(e.Message); Logging.enable = false; } try { Logging.filePath = Tools.Logging.Path; } catch (Exception e) { SimpleLogger.WriteLine(e.Message); Logging.filePath = Environment.CurrentDirectory + "\\logs"; } */ // �A�C�R���ݒ� try { Icons.resourceName = Tools.Icon.resourceName; } catch (Exception e) { SimpleLogger.WriteLine(e.Message); Icons.resourceName = "char99"; // default } // �t���[�Y�ݒ� try { if (Tools.HungupTime.enable == "true") { HungUp.enable = true; } else { HungUp.enable = false; } } catch (Exception e) { SimpleLogger.WriteLine(e.Message); SimpleLogger.WriteLine("load default: [HungUp] enable"); HungUp.enable = true; } try { HungUp.sec = Tools.HungupTime.sec; } catch (Exception e) { SimpleLogger.WriteLine(e.Message); SimpleLogger.WriteLine("load default: [HungUp] time = 60"); HungUp.sec = 60; } // �A�b�v�f�[�g�`�F�b�N�ݒ� try { if (Tools.UpdateCheck.startup.ToLower() == "true") { Update.startupAutoCehck = true; } else { Update.startupAutoCehck = false; } } catch (Exception e) { SimpleLogger.WriteLine(e.Message); SimpleLogger.WriteLine("load default: [StartupAutoCheck] false"); Update.startupAutoCehck = false; } // �x�[�^�A�b�v�f�[�g�ݒ� try { if (Tools.UpdateCheck.checkBeta.ToLower() == "true") { Update.checkBetaVersion = true; } else { Update.checkBetaVersion = false; } } catch (Exception e) { SimpleLogger.WriteLine(e.Message); SimpleLogger.WriteLine("load default: [BetaCheck] false"); Update.checkBetaVersion = false; } // �Q�[���N�����@�ݒ� try { GameStartUp.mode = Tools.StartUpGame.mode; } catch (Exception e) { SimpleLogger.WriteLine(e.Message); SimpleLogger.WriteLine("load default: [GameStartUp] mode=0"); GameStartUp.mode = RUN_GAME_DIRECT; } } catch (FileLoadException fle) { SimpleLogger.WriteLine(fle.Message); MessageBox.Show("��O�G���[:" + Environment.NewLine + "�t�@�C���̓ǂݍ��݂Ɏ��s���܂����B", "FileLoadException error", MessageBoxButtons.OK, MessageBoxIcon.Error); HungUp.sec = 60; HungUp.enable = true; Update.startupAutoCehck = false; Update.checkBetaVersion = false; GameStartUp.mode = RUN_GAME_DIRECT; Icons.resourceName = "char99"; } catch (System.Xml.XmlException xe) { SimpleLogger.WriteLine(xe.Message); MessageBox.Show("��O�G���[:" + Environment.NewLine + "�f�[�^�̏����Ɏ��s���܂����B", "XmlException error", MessageBoxButtons.OK, MessageBoxIcon.Error); HungUp.sec = 60; HungUp.enable = true; Update.startupAutoCehck = false; Update.checkBetaVersion = false; GameStartUp.mode = RUN_GAME_DIRECT; Icons.resourceName = "char99"; } catch (System.InvalidOperationException ioe) { SimpleLogger.WriteLine(ioe.Message); MessageBox.Show("��O�G���[:" + Environment.NewLine + "�����ȃ��\�b�h�̌Ăяo�����s���܂����B", "InvalidOperationException error", MessageBoxButtons.OK, MessageBoxIcon.Error); HungUp.sec = 60; HungUp.enable = true; Update.startupAutoCehck = false; Update.checkBetaVersion = false; GameStartUp.mode = RUN_GAME_DIRECT; Icons.resourceName = "char99"; } } else { SimpleLogger.WriteLine("setting file 'settings.xml' could not read/found."); MessageBox.Show("�ݒ�t�@�C����ǂݍ��߂܂���ł����B" + Environment.NewLine + "'" + filepath + "'", "TSLoginManager", MessageBoxButtons.OK, MessageBoxIcon.Warning); HungUp.sec = 60; HungUp.enable = true; Update.startupAutoCehck = false; Update.checkBetaVersion = false; GameStartUp.mode = RUN_GAME_DIRECT; Icons.resourceName = "char99"; } }
public static void SaveConfiguration(string currentConfig, int selectedItem, string selectedItemLabel) { LogMyFilms.Debug("MFC: Configuration saving started for '" + currentConfig + "'"); using (var xmlConfig = new XmlSettings(Config.GetFile(Config.Dir.Config, "MyFilms.xml"))) { #region save xml data //XmlConfig XmlConfig = new XmlConfig(); xmlConfig.WriteXmlConfig("MyFilms", "MyFilms", "Current_Config", currentConfig); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "StrSelect", MyFilms.conf.StrSelect); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "StrPersons", MyFilms.conf.StrPersons); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "StrTitleSelect", MyFilms.conf.StrTitleSelect); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "StrFilmSelect", MyFilms.conf.StrFilmSelect); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "StrViewSelect", MyFilms.conf.StrViewSelect); // Custom View filter xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "StrDfltSelect", MyFilms.conf.StrDfltSelect); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "StrSort", MyFilms.conf.StrSorta); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "StrSortSens", MyFilms.conf.StrSortSens); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "StrSortInHierarchies", MyFilms.conf.StrSortaInHierarchies); //InHierarchies xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "StrSortSensInHierarchies", MyFilms.conf.StrSortSensInHierarchies); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "ViewContext", Enum.GetName(typeof(MyFilms.ViewContext), MyFilms.conf.ViewContext)); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "View", MyFilms.conf.StrTxtView); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "Selection", MyFilms.conf.StrTxtSelect); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "IndexItem", (selectedItem > -1) ? (selectedItem.ToString()) : "-1"); //may need to check if there is no item selected and so save -1 xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "TitleItem", (selectedItem > -1) ? ((MyFilms.conf.Boolselect) ? selectedItem.ToString() : selectedItemLabel) : string.Empty); //may need to check if there is no item selected and so save "" xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "Boolselect", MyFilms.conf.Boolselect); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "Boolreturn", MyFilms.conf.Boolreturn); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "Boolindexed", MyFilms.conf.Boolindexed); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "Boolindexedreturn", MyFilms.conf.Boolindexedreturn); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "IndexedChars", MyFilms.conf.IndexedChars); // XmlConfig.WriteXmlConfig("MyFilms", currentConfig, "ReversePersonNames", MyFilms.conf.BoolReverseNames); // removed, to make it NonPersistant xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "VirtualPathBrowsing", MyFilms.conf.BoolVirtualPathBrowsing); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "AskForPlaybackQuality", MyFilms.conf.BoolAskForPlaybackQuality); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "WSelectedLabel", MyFilms.conf.Wselectedlabel); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "WStrSort", MyFilms.conf.WStrSort); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "Wstar", MyFilms.conf.Wstar); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "LayOut", MyFilms.conf.StrLayOut); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "LayOutInHierarchies", MyFilms.conf.StrLayOutInHierarchies); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "WLayOut", MyFilms.conf.WStrLayOut); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "LastID", MyFilms.conf.LastID); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "SearchHistory", MyFilms.conf.StrSearchHistory); xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "UserProfileName", MyFilms.conf.StrUserProfileName); //foreach (KeyValuePair<string, ViewState> viewState in MyFilms.ViewStateCache) //{ // XmlConfig.WriteXmlConfig("MyFilms", currentConfig, "ViewState-" + viewState.Key, viewState.Value.SaveToString()); //} //foreach (View viewstate in MyFilms.conf.CustomView.View) //{ // string viewstateName = "ViewState-" + viewstate.ViewDBItem; // XmlConfig.WriteXmlConfig("MyFilms", currentConfig, viewstateName, MyFilms.conf.CurrentView.SaveToString()); //} //XmlConfig.WriteXmlConfig("MyFilms", currentConfig, "CurrentView", MyFilms.conf.CurrentView.SaveToString()); switch (MyFilms.conf.StrFileType) { case CatalogType.DVDProfiler: xmlConfig.WriteXmlConfig("MyFilms", currentConfig, "AntCatalogTemp", MyFilms.conf.StrFileXml); break; } #endregion // XmlConfig.Dispose(); // XmlSettings.SaveCache(); } LogMyFilms.Debug("MFC: Configuration saving ended for '" + currentConfig + "'"); }
public ConfigData(string file) { this.showInfoIcons = true; this.showInfoIconsBackground = true; this.useSeasonPoster = true; this.enableVideoBackdrop = true; this.showconfig = true; this.npvAR = "Normal"; this.themeCustomFont = "Default"; this.shownowplayingicon = true; this.showcoverflowtitle = true; this.showcoverflowdetails = true; this.disableehsmovietitle = true; this.showcoverflowlogos = false; this.showlistlogos = true; this.showposterlogos = true; this.showthumblogos = true; this.showstriplogos = true; this.showcoverflowendtime = true; this.showlistendtime = true; this.showposterendtime = true; this.showthumbendtime = true; this.showcoverflowposteroverlay = true; this.showcoverflowtotalnumber = true; useCustomTvView = true; this.file = file; this.ChocolateSettings = XmlSettings<ConfigData>.Bind(this, file); }