public static void LoadSettings() { using ( MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings( MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Config, "MediaPortal.xml"))) { // Load previously incorrectly set value if it exists and clear afterwards int RemoteKeyDialogContextMenuOld = reader.GetValueAsInt("VideoCleaner", "remoteKeyDialogContextMenu", -1); if (RemoteKeyDialogContextMenuOld != -1) { RemoteKeyDialogContextMenu = RemoteKeyDialogContextMenuOld; reader.RemoveEntry("VideoCleaner", "remoteKeyDialogContextMenu"); } else { RemoteKeyDialogContextMenu = reader.GetValueAsInt("AudioSwitcher", "remoteKeyDialogContextMenu", 0); } RemoteKeyDialogContextMenu = reader.GetValueAsInt("AudioSwitcher", "remoteKeyDialogContextMenu", 0); DefaultPlaybackDevice = reader.GetValueAsString("AudioSwitcher", "defaultPlaybackDevice", ""); LAVbitstreamAlwaysShowToggleInContextMenu = reader.GetValueAsBool("AudioSwitcher", "LAVbitstreamAlwaysShowToggleInContextMenu", false); LAVbitstreamPerDevice = reader.GetValueAsBool("AudioSwitcher", "LAVbitstreamPerDevice", false); LAVbitstreamPropertyList = reader.GetValueAsString("AudioSwitcher", "LAVbitstreamPropertyList", ""); LAVaudioDelayControlsInContextMenu = reader.GetValueAsBool("AudioSwitcher", "LAVaudioDelayControlsInContextMenu", false); LAVaudioDelayEnabled = reader.GetValueAsBool("AudioSwitcher", "LAVaudioDelayEnabled", false); LAVaudioDelay = reader.GetValueAsString("AudioSwitcher", "LAVaudioDelay", "0"); } }
public static void LoadSettings() { using ( MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings( MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Config, "MediaPortal.xml"))) { DisableOnStart = reader.GetValueAsBool("HyperionScreenCapture", "disableOnStart", true); OnlyEnableWithMadVr = reader.GetValueAsBool("HyperionScreenCapture", "onlyEnableWithMadVr", false); RemoteToggleKey = reader.GetValueAsInt("HyperionScreenCapture", "remoteToggleKey", 0); ApiPort = reader.GetValueAsInt("HyperionScreenCapture", "apiPort", 29445); } }
public SetupForm() { InitializeComponent(); labelDefaultPort.Text = String.Format("(Default: {0})", WifiRemote.DEFAULT_PORT); // load port from settings using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { originalPort = reader.GetValue(WifiRemote.PLUGIN_NAME, "port"); checkBoxDisableBonjour.Checked = reader.GetValueAsBool(WifiRemote.PLUGIN_NAME, "disableBonjour", false); textBoxName.Text = reader.GetValueAsString(WifiRemote.PLUGIN_NAME, "serviceName", WifiRemote.GetServiceName()); checkBoxShowConnectionMessage.Checked = reader.GetValueAsBool(WifiRemote.PLUGIN_NAME, "showNotifications", false); txtUsername.Text = WifiRemote.DecryptString(reader.GetValueAsString(WifiRemote.PLUGIN_NAME, "username", "")); txtPassword.Text = WifiRemote.DecryptString(reader.GetValueAsString(WifiRemote.PLUGIN_NAME, "password", "")); txtPasscode.Text = WifiRemote.DecryptString(reader.GetValueAsString(WifiRemote.PLUGIN_NAME, "passcode", "")); cbAuthMethod.SelectedIndex = reader.GetValueAsInt(WifiRemote.PLUGIN_NAME, "auth", 0); numericUpDownAutologin.Value = reader.GetValueAsInt(WifiRemote.PLUGIN_NAME, "autologinTimeout", 0); resetPort(); // Read plugin ids and convert them to int String[] savedPluginStrings = reader.GetValueAsString(WifiRemote.PLUGIN_NAME, "savedPlugins", "").Split('|'); savedPlugins = new Dictionary<int, string>(); for (int j = 0; j + 1 < savedPluginStrings.Length; j = j + 2) { // Add plugin id and name int i; if (int.TryParse(savedPluginStrings[j], out i)) { savedPlugins.Add(i, savedPluginStrings[j + 1]); } } // Read ignored plugins // Ignored by default: // -1: // 0: home // 3005: GUITopbar // 730716: fanart handler String[] ignoredPluginsString = reader.GetValueAsString(WifiRemote.PLUGIN_NAME, "ignoredPlugins", "-1|0|3005|730716").Split('|'); ignoredPluginsList = new List<int>(); foreach (String pluginId in ignoredPluginsString) { int i; if (int.TryParse(pluginId, out i)) { ignoredPluginsList.Add(i); } } } // Test if Bonjour is installed try { Version bonjourVersion = ZeroconfService.NetService.DaemonVersion; buttonDownloadBonjour.Enabled = false; checkBoxDisableBonjour.Enabled = false; buttonDownloadBonjour.Text = "Bonjour already installed"; } catch { if (Is64Bit() || Is32BitProcessOn64BitProcessor()) { // 64 bit windows is64bit = true; buttonDownloadBonjour.Enabled = true; checkBoxDisableBonjour.Enabled = true; buttonDownloadBonjour.Text = "Download and install Bonjour (64 bit)"; } else { // 32 bit windows is64bit = false; buttonDownloadBonjour.Enabled = true; checkBoxDisableBonjour.Enabled = true; buttonDownloadBonjour.Text = "Download and install Bonjour (32 bit)"; } } // Setup plugins list availablePlugins = new ArrayList(); plugins = new ArrayList(); pluginIcons = new ImageList(); pluginIcons.ImageSize = new Size(20, 20); EnumerateWindowPlugins(); LoadPlugins(); LoadSettings(); // Add saved plugins to list for ordering foreach (var aSavedPlugin in savedPlugins) { // Find saved plugin with this window id var query = from ItemTag p in plugins where p.WindowId == aSavedPlugin.Key select p; // Add the first found plugin to the list foreach (ItemTag plugin in query) { if (plugin.IsEnabled) { pluginsDataSource.Add(new WindowPlugin(aSavedPlugin.Value, aSavedPlugin.Key, (plugin.ActiveImage != null) ? ImageHelper.imageToByteArray(plugin.ActiveImage, System.Drawing.Imaging.ImageFormat.Png) : ImageHelper.imageToByteArray(Properties.Resources.NoPluginImage, System.Drawing.Imaging.ImageFormat.Png), !ignoredPluginsList.Contains(aSavedPlugin.Key))); } break; } } // Add rest of the plugins to the list foreach (ItemTag plugin in plugins) { if (!savedPlugins.ContainsKey(plugin.WindowId)) { addPluginToList(plugin); } } dataGridViewPluginList.AutoGenerateColumns = false; dataGridViewPluginList.AutoSize = true; dataGridViewPluginList.DataSource = pluginsDataSource; dataGridViewPluginList.CurrentCellDirtyStateChanged += new EventHandler(dataGridViewPluginList_CurrentCellDirtyStateChanged); DataGridViewCheckBoxColumn displayColumn = new DataGridViewCheckBoxColumn(); displayColumn.ReadOnly = false; displayColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader; displayColumn.DataPropertyName = "DisplayPlugin"; displayColumn.Name = ""; dataGridViewPluginList.Columns.Add(displayColumn); DataGridViewImageColumn iconColumn = new DataGridViewImageColumn(false); iconColumn.ReadOnly = true; iconColumn.ImageLayout = DataGridViewImageCellLayout.Zoom; iconColumn.Width = 20; iconColumn.DataPropertyName = "Icon"; iconColumn.Name = ""; dataGridViewPluginList.Columns.Add(iconColumn); DataGridViewColumn nameColumn = new DataGridViewTextBoxColumn(); nameColumn.ReadOnly = false; nameColumn.MinimumWidth = 200; nameColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; nameColumn.DataPropertyName = "Name"; nameColumn.Name = "Plugin"; dataGridViewPluginList.Columns.Add(nameColumn); }
public MyLyricsSetup() { LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, MyLyricsSettings.LogName)); //LyricDiagnostics.OpenLog(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log)); #region Initialize GUI and class InitializeComponent(); lyricsLibraryUC = new MyLyricsSetup_LyricsLibrary(this); this.tabPageLyricsDatabase.Controls.Add(lyricsLibraryUC); // initialize delegates m_DelegateLyricFound = new DelegateLyricFound(this.lyricFoundMethod); m_DelegateLyricNotFound = new DelegateLyricNotFound(this.lyricNotFoundMethod); m_DelegateThreadFinished = new DelegateThreadFinished(this.ThreadFinishedMethod); m_DelegateThreadException = new DelegateThreadException(this.ThreadExceptionMethod); // Grab music database MusicDatabase dbs = new MusicDatabase(); m_TotalTitles = dbs.GetNumOfSongs(); #endregion #region Get settings from in MediaPortal.xml using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) { try { tbLimit.Text = xmlreader.GetValueAsString("myLyrics", "limit", m_TotalTitles.ToString()); tbPluginName.Text = xmlreader.GetValueAsString("myLyrics", "pluginsName", "My Lyrics"); cbAutoFetch.Checked = xmlreader.GetValueAsBool("myLyrics", "automaticFetch", true); cbAutomaticUpdate.Checked = xmlreader.GetValueAsBool("myLyrics", "automaticUpdateWhenFirstFound", false); cbMoveSongFrom.Checked = xmlreader.GetValueAsBool("myLyrics", "moveLyricFromMarkedDatabase", true); lbSongsLimitNote.Text = ("(You have currently " + m_TotalTitles.ToString() + " titles in your music database)"); rdDefault.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useDefaultSitesMode", "True")).ToString().Equals("True") ? true : false; trackBar.Value = ((int)xmlreader.GetValueAsInt("myLyrics", "defaultSitesModeValue", 2)); trackBar_Scroll(null, null); if (!rdDefault.Checked) { trackBar.Enabled = false; rbUserDefined.Checked = true; cbLyricWiki.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricWiki", "True")).ToString().Equals("True") ? true : false; cbEvilLabs.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useEvilLabs", "True")).ToString().Equals("True") ? true : false; cbLyrics007.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyrics007", "True")).ToString().Equals("True") ? true : false; cbLyricsOnDemand.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsOnDemand", "True")).ToString().Equals("True") ? true : false; cbSeekLyrics.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useSeekLyrics", "True")).ToString().Equals("True") ? true : false; cbHotLyrics.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useHotLyrics", "True")).ToString().Equals("True") ? true : false; } } catch { MessageBox.Show("Something has gone wrong when reading Mediaportal.xml"); } } #endregion #region Serialzie/deserialize lyricsdatabases string lyricsXMLpath = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Base, MyLyricsSettings.LyricsXMLName); FileInfo lyricsXMLfileInfo = new FileInfo(lyricsXMLpath); // If lyrics.xml present, then convert database to new format... if (lyricsXMLfileInfo.Exists) { string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); FileInfo fileInfo = new FileInfo(path); // .. but only if it hasn't already been converted if (fileInfo.Exists == false) { if (MessageBox.Show(this, "Your database will have to be upgraded to work with this version\r\nUpgrade now?", "Upgrade lyricsdatabase", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { ConvertFromXMLtoLyricsDatabase convertFromXMLtoLyricsDatabase = new ConvertFromXMLtoLyricsDatabase(); MyLyricsSettings.LyricsDB = convertFromXMLtoLyricsDatabase.Convert(lyricsXMLpath); // Create file to save the database to FileStream fs = new FileStream(path, FileMode.Create); // Create a BinaryFormatter object to perform the serialization BinaryFormatter bf = new BinaryFormatter(); // Use the BinaryFormatter object to serialize the database to the file bf.Serialize(fs, MyLyricsSettings.LyricsDB); fs.Close(); // Create likewise a database for the remainingLyrics path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); fs = new FileStream(path, FileMode.Create); MyLyricsSettings.LyricsMarkedDB = new LyricsDatabase(); bf.Serialize(fs, MyLyricsSettings.LyricsMarkedDB); // Close the file fs.Close(); } } // ... else deserialize the databases and save reference in LyricsDB and LyricsMarkedDB else { DeserializeBothDB(); } } // If no Lyrics.xml present in base, then create new serialized databases else { string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); FileInfo fileInfo = new FileInfo(path); // .. but only if the databases hasn't been created if (fileInfo.Exists == false) { path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName); // Serialize empty LyricsDatabase if no lyrics.xml present FileStream fs = new FileStream(path, FileMode.Create); BinaryFormatter bf = new BinaryFormatter(); MyLyricsSettings.LyricsDB = new LyricsDatabase(); bf.Serialize(fs, MyLyricsSettings.LyricsDB); fs.Close(); // Serialize empty LyricsMarkedDatabase path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName); fs = new FileStream(path, FileMode.Create); MyLyricsSettings.LyricsMarkedDB = new LyricsDatabase(); bf.Serialize(fs, MyLyricsSettings.LyricsMarkedDB); fs.Close(); } else { DeserializeBothDB(); } } MyLyricsSetup_LyricsLibrary.CurrentDB = MyLyricsSettings.LyricsDB; #endregion lyricsLibraryUC.updateLyricsTree(); }
public SetupForm() { InitializeComponent(); labelDefaultPort.Text = String.Format("(Default: {0})", WifiRemote.DEFAULT_PORT); // load port from settings using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { originalPort = reader.GetValue(WifiRemote.PLUGIN_NAME, "port"); checkBoxDisableBonjour.Checked = reader.GetValueAsBool(WifiRemote.PLUGIN_NAME, "disableBonjour", false); textBoxName.Text = reader.GetValueAsString(WifiRemote.PLUGIN_NAME, "serviceName", WifiRemote.GetServiceName()); checkBoxShowConnectionMessage.Checked = reader.GetValueAsBool(WifiRemote.PLUGIN_NAME, "showNotifications", false); txtUsername.Text = WifiRemote.DecryptString(reader.GetValueAsString(WifiRemote.PLUGIN_NAME, "username", "")); txtPassword.Text = WifiRemote.DecryptString(reader.GetValueAsString(WifiRemote.PLUGIN_NAME, "password", "")); txtPasscode.Text = WifiRemote.DecryptString(reader.GetValueAsString(WifiRemote.PLUGIN_NAME, "passcode", "")); cbAuthMethod.SelectedIndex = reader.GetValueAsInt(WifiRemote.PLUGIN_NAME, "auth", 0); numericUpDownAutologin.Value = reader.GetValueAsInt(WifiRemote.PLUGIN_NAME, "autologinTimeout", 0); resetPort(); // Read plugin ids and convert them to int String[] savedPluginStrings = reader.GetValueAsString(WifiRemote.PLUGIN_NAME, "savedPlugins", "").Split('|'); savedPlugins = new Dictionary <int, string>(); for (int j = 0; j + 1 < savedPluginStrings.Length; j = j + 2) { // Add plugin id and name int i; if (int.TryParse(savedPluginStrings[j], out i)) { try { savedPlugins.Add(i, savedPluginStrings[j + 1]); } catch (Exception e) { WifiRemote.LogMessage("Adding saved plugin from config failed: " + e.Message, WifiRemote.LogType.Debug); } } } // Read ignored plugins // Ignored by default: // -1: // 0: home // 3005: GUITopbar // 730716: fanart handler String[] ignoredPluginsString = reader.GetValueAsString(WifiRemote.PLUGIN_NAME, "ignoredPlugins", "-1|0|3005|730716").Split('|'); ignoredPluginsList = new List <int>(); foreach (String pluginId in ignoredPluginsString) { int i; if (int.TryParse(pluginId, out i)) { try { ignoredPluginsList.Add(i); } catch (Exception e) { WifiRemote.LogMessage("Adding ignored plugin from config failed: " + e.Message, WifiRemote.LogType.Debug); } } } } // Test if Bonjour is installed try { Version bonjourVersion = ZeroconfService.NetService.DaemonVersion; buttonDownloadBonjour.Enabled = false; checkBoxDisableBonjour.Enabled = false; buttonDownloadBonjour.Text = "Bonjour already installed"; } catch { if (Is64Bit() || Is32BitProcessOn64BitProcessor()) { // 64 bit windows is64bit = true; buttonDownloadBonjour.Enabled = true; checkBoxDisableBonjour.Enabled = true; buttonDownloadBonjour.Text = "Download and install Bonjour (64 bit)"; } else { // 32 bit windows is64bit = false; buttonDownloadBonjour.Enabled = true; checkBoxDisableBonjour.Enabled = true; buttonDownloadBonjour.Text = "Download and install Bonjour (32 bit)"; } } // Setup plugins list availablePlugins = new ArrayList(); plugins = new ArrayList(); pluginIcons = new ImageList(); pluginIcons.ImageSize = new Size(20, 20); EnumerateWindowPlugins(); LoadPlugins(); LoadSettings(); // Add saved plugins to list for ordering foreach (var aSavedPlugin in savedPlugins) { // Find saved plugin with this window id var query = from ItemTag p in plugins where p.WindowId == aSavedPlugin.Key select p; // Add the first found plugin to the list foreach (ItemTag plugin in query) { if (plugin.IsEnabled) { pluginsDataSource.Add(new WindowPlugin(aSavedPlugin.Value, aSavedPlugin.Key, (plugin.ActiveImage != null) ? ImageHelper.imageToByteArray(plugin.ActiveImage, System.Drawing.Imaging.ImageFormat.Png) : ImageHelper.imageToByteArray(Properties.Resources.NoPluginImage, System.Drawing.Imaging.ImageFormat.Png), !ignoredPluginsList.Contains(aSavedPlugin.Key))); } break; } } // Add rest of the plugins to the list foreach (ItemTag plugin in plugins) { if (!savedPlugins.ContainsKey(plugin.WindowId)) { addPluginToList(plugin); } } dataGridViewPluginList.AutoGenerateColumns = false; dataGridViewPluginList.AutoSize = true; dataGridViewPluginList.DataSource = pluginsDataSource; dataGridViewPluginList.CurrentCellDirtyStateChanged += new EventHandler(dataGridViewPluginList_CurrentCellDirtyStateChanged); DataGridViewCheckBoxColumn displayColumn = new DataGridViewCheckBoxColumn(); displayColumn.ReadOnly = false; displayColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader; displayColumn.DataPropertyName = "DisplayPlugin"; displayColumn.Name = ""; dataGridViewPluginList.Columns.Add(displayColumn); DataGridViewImageColumn iconColumn = new DataGridViewImageColumn(false); iconColumn.ReadOnly = true; iconColumn.ImageLayout = DataGridViewImageCellLayout.Zoom; iconColumn.Width = 20; iconColumn.DataPropertyName = "Icon"; iconColumn.Name = ""; dataGridViewPluginList.Columns.Add(iconColumn); DataGridViewColumn nameColumn = new DataGridViewTextBoxColumn(); nameColumn.ReadOnly = false; nameColumn.MinimumWidth = 200; nameColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; nameColumn.DataPropertyName = "Name"; nameColumn.Name = "Plugin"; dataGridViewPluginList.Columns.Add(nameColumn); }
public static void LoadSettings() { using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Config, "MediaPortal.xml"))) { // Legacy support // The effect settings were integers in the past, but now are strings. // In order to avoid a lot of people loosing their effect settings during an update, // we convert the old settings to the new ones. int effectVideoInt; if (int.TryParse(reader.GetValueAsString("atmolight", "effectVideo", "MediaPortalLiveMode"), out effectVideoInt)) { effectVideo = OldIntToNewContentEffect(effectVideoInt); SaveSpecificSetting("effectVideo", effectVideo.ToString()); } else { effectVideo = (ContentEffect)Enum.Parse(typeof(ContentEffect), reader.GetValueAsString("atmolight", "effectVideo", "MediaPortalLiveMode")); } int effectMusicInt; if (int.TryParse(reader.GetValueAsString("atmolight", "effectMusic", "LEDsDisabled"), out effectMusicInt)) { effectMusic = OldIntToNewContentEffect(effectMusicInt); SaveSpecificSetting("effectMusic", effectMusic.ToString()); } else { effectMusic = (ContentEffect)Enum.Parse(typeof(ContentEffect), reader.GetValueAsString("atmolight", "effectMusic", "LEDsDisabled")); } int effecRadioInt; if (int.TryParse(reader.GetValueAsString("atmolight", "effectRadio", "LEDsDisabled"), out effecRadioInt)) { effectRadio = OldIntToNewContentEffect(effecRadioInt); SaveSpecificSetting("effectRadio", effectRadio.ToString()); } else { effectRadio = (ContentEffect)Enum.Parse(typeof(ContentEffect), reader.GetValueAsString("atmolight", "effectRadio", "LEDsDisabled")); } int effectMenuInt; if (int.TryParse(reader.GetValueAsString("atmolight", "effectMenu", "LEDsDisabled"), out effectMenuInt)) { effectMenu = OldIntToNewContentEffect(effectMenuInt); SaveSpecificSetting("effectMenu", effectMenu.ToString()); } else { effectMenu = (ContentEffect)Enum.Parse(typeof(ContentEffect), reader.GetValueAsString("atmolight", "effectMenu", "LEDsDisabled")); } int effectMPExitInt; if (int.TryParse(reader.GetValueAsString("atmolight", "effectMPExit", "LEDsDisabled"), out effectMPExitInt)) { effectMPExit = OldIntToNewContentEffect(effectMPExitInt == 4 ? 5 : effectMPExitInt); SaveSpecificSetting("effectMPExit", effectMPExit.ToString()); } else { effectMPExit = (ContentEffect)Enum.Parse(typeof(ContentEffect), reader.GetValueAsString("atmolight", "effectMPExit", "LEDsDisabled")); } currentLanguage = reader.GetValueAsString("atmolight", "currentLanguage", "English"); // Check for presence of legacy file location (1.7.0.5 or lower) currentLanguageFileLegacy = reader.GetValueAsString("atmolight", "currentLanguageFile", ""); if (!string.IsNullOrEmpty(currentLanguageFileLegacy)) { if (currentLanguageFileLegacy.Contains("nl.xml")) { currentLanguage = "Dutch"; } else if (currentLanguageFileLegacy.Contains("en.xml")) { currentLanguage = "English"; } else if (currentLanguageFileLegacy.Contains("fr.xml")) { currentLanguage = "French"; } else if (currentLanguageFileLegacy.Contains("de.xml")) { ; currentLanguage = "German"; } } string mediaportalLanguageDir = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Language) + "\\"; if (string.IsNullOrEmpty(mediaportalLanguageDir) || !Directory.Exists(mediaportalLanguageDir)) { mediaportalLanguageDir = @"C:\ProgramData\Team MediaPortal\MediaPortal\Language\"; } try { switch (currentLanguage) { case "Dutch": currentLanguageFileLocation = mediaportalLanguageDir + "\\AtmoLight\\nl.xml"; break; case "English": currentLanguageFileLocation = mediaportalLanguageDir + "\\AtmoLight\\en.xml"; break; case "French": currentLanguageFileLocation = mediaportalLanguageDir + "\\AtmoLight\\fr.xml"; break; case "German": currentLanguageFileLocation = mediaportalLanguageDir + "\\AtmoLight\\de.xml"; break; } } catch (Exception ex) { Log.Error("Error during LoadSettings"); Log.Error(ex.Message); throw; } // Normal settings loading atmowinExe = reader.GetValueAsString("atmolight", "atmowinexe", ""); killButton = reader.GetValueAsInt("atmolight", "killbutton", 4); profileButton = reader.GetValueAsInt("atmolight", "cmbutton", 4); menuButton = reader.GetValueAsInt("atmolight", "menubutton", 4); excludeTimeStart = LoadTimeSetting(reader, "excludeTimeStart", "00:00"); excludeTimeEnd = LoadTimeSetting(reader, "excludeTimeEnd", "00:00"); manualMode = reader.GetValueAsBool("atmolight", "OffOnStart", false); sbs3dOn = reader.GetValueAsBool("atmolight", "SBS_3D_ON", false); lowCPU = reader.GetValueAsBool("atmolight", "lowCPU", false); lowCPUTime = reader.GetValueAsInt("atmolight", "lowCPUTime", 0); delay = reader.GetValueAsBool("atmolight", "Delay", false); delayReferenceRefreshRate = reader.GetValueAsInt("atmolight", "DelayRefreshRate", 0); // Legacy reference time delayReferenceTime = reader.GetValueAsInt("atmolight", "DelayTime", 0); // New reference times delayReferenceTime23 = reader.GetValueAsInt("atmolight", "DelayTime23", 0); delayReferenceTime24 = reader.GetValueAsInt("atmolight", "DelayTime24", 0); delayReferenceTime50 = reader.GetValueAsInt("atmolight", "DelayTime50", 0); delayReferenceTime59 = reader.GetValueAsInt("atmolight", "DelayTime59", 0); // If all of the specific refresh values are 0, assume upgrade setting from single rate if (delayReferenceTime23 == 0 && delayReferenceTime24 == 0 && delayReferenceTime50 == 0 && delayReferenceTime59 == 0) { switch (delayReferenceRefreshRate) { case 23: delayReferenceTime23 = delayReferenceTime; break; case 24: delayReferenceTime24 = delayReferenceTime; break; case 50: delayReferenceTime50 = delayReferenceTime; break; case 59: delayReferenceTime59 = delayReferenceTime; break; } } exitAtmoWin = reader.GetValueAsBool("atmolight", "ExitAtmoWin", true); startAtmoWin = reader.GetValueAsBool("atmolight", "StartAtmoWin", true); atmoWakeHelperEnabled = reader.GetValueAsBool("atmolight", "atmoWakeHelperEnabled", false); atmoWakeHelperComPort = reader.GetValueAsString("atmolight", "atmoWakeHelperComPort", ""); atmoWakeHelperResumeDelay = reader.GetValueAsInt("atmolight", "atmoWakeHelperResumeDelay", 2500); atmoWakeHelperDisconnectDelay = reader.GetValueAsInt("atmolight", "atmoWakeHelperDisconnectDelay", 1500); atmoWakeHelperConnectDelay = reader.GetValueAsInt("atmolight", "atmoWakeHelperConnectDelay", 1500); atmoWakeHelperReinitializationDelay = reader.GetValueAsInt("atmolight", "atmoWakeHelperReinitializationDelay", 0); staticColorRed = reader.GetValueAsInt("atmolight", "StaticColorRed", 0); staticColorGreen = reader.GetValueAsInt("atmolight", "StaticColorGreen", 0); staticColorBlue = reader.GetValueAsInt("atmolight", "StaticColorBlue", 0); restartOnError = reader.GetValueAsBool("atmolight", "RestartOnError", true); trueGrabbing = reader.GetValueAsBool("atmolight", "TrueGrabbing", true); blackbarDetection = reader.GetValueAsBool("atmolight", "BlackbarDetection", false); blackbarDetectionTime = reader.GetValueAsInt("atmolight", "BlackbarDetectionTime", 1000); gifFile = reader.GetValueAsString("atmolight", "GIFFile", ""); captureWidth = reader.GetValueAsInt("atmolight", "captureWidth", 64); captureHeight = reader.GetValueAsInt("atmolight", "captureHeight", 64); monitorScreensaverState = reader.GetValueAsBool("atmolight", "monitorScreensaverState", true); monitorWindowState = reader.GetValueAsBool("atmolight", "monitorWindowState", true); hyperionIP = reader.GetValueAsString("atmolight", "hyperionIP", "127.0.0.1"); hyperionPort = reader.GetValueAsInt("atmolight", "hyperionPort", 19445); hyperionReconnectDelay = reader.GetValueAsInt("atmolight", "hyperionReconnectDelay", 10000); hyperionReconnectAttempts = reader.GetValueAsInt("atmolight", "hyperionReconnectAttempts", 5); hyperionPriority = reader.GetValueAsInt("atmolight", "hyperionPriority", 1); hyperionPriorityStaticColor = reader.GetValueAsInt("atmolight", "hyperionStaticColorPriority", 1); hyperionLiveReconnect = reader.GetValueAsBool("atmolight", "hyperionLiveReconnect", false); hueExe = reader.GetValueAsString("atmolight", "hueExe", ""); hueStart = reader.GetValueAsBool("atmolight", "hueStart", true); hueIsRemoteMachine = reader.GetValueAsBool("atmolight", "hueIsRemoteMachine", false); hueIP = reader.GetValueAsString("atmolight", "hueIP", "127.0.0.1"); huePort = reader.GetValueAsInt("atmolight", "huePort", 20123); hueReconnectDelay = reader.GetValueAsInt("atmolight", "hueReconnectDelay", 10000); hueReconnectAttempts = reader.GetValueAsInt("atmolight", "hueReconnectAttempts", 5); hueBridgeEnableOnResume = reader.GetValueAsBool("atmolight", "hueBridgeEnableOnResume", false); hueBridgeDisableOnSuspend = reader.GetValueAsBool("atmolight", "hueBridgeDisableOnSuspend", false); hueTheaterEnabled = reader.GetValueAsBool("atmolight", "hueTheaterEnabled", false); hueTheaterRestoreLights = reader.GetValueAsBool("atmolight", "hueTheaterRestoreLights", false); hueTheaterEnabledVU = reader.GetValueAsBool("atmolight", "hueTheaterEnabledVU", false); boblightIP = reader.GetValueAsString("atmolight", "boblightIP", "127.0.0.1"); boblightPort = reader.GetValueAsInt("atmolight", "boblightPort", 19333); boblightMaxFPS = reader.GetValueAsInt("atmolight", "boblightMaxFPS", 10); boblightMaxReconnectAttempts = reader.GetValueAsInt("atmolight", "boblightMaxReconnectAttempts", 5); boblightReconnectDelay = reader.GetValueAsInt("atmolight", "boblightReconnectDelay", 5000); boblightSpeed = reader.GetValueAsInt("atmolight", "boblightSpeed", 100); boblightAutospeed = reader.GetValueAsInt("atmolight", "boblightAutospeed", 0); boblightInterpolation = reader.GetValueAsBool("atmolight", "boblightInterpolation", true); boblightSaturation = reader.GetValueAsInt("atmolight", "boblightSaturation", 1); boblightValue = reader.GetValueAsInt("atmolight", "boblightValue", 1); boblightThreshold = reader.GetValueAsInt("atmolight", "boblightThreshold", 20); boblightGamma = Double.Parse(reader.GetValueAsString("atmolight", "boblightGamma", "2.2").Replace(",", "."), CultureInfo.InvariantCulture.NumberFormat); atmoWinTarget = reader.GetValueAsBool("atmolight", "atmoWinTarget", true); boblightTarget = reader.GetValueAsBool("atmolight", "boblightTarget", false); hueTarget = reader.GetValueAsBool("atmolight", "hueTarget", false); hyperionTarget = reader.GetValueAsBool("atmolight", "hyperionTarget", false); blackbarDetectionThreshold = reader.GetValueAsInt("atmolight", "blackbarDetectionThreshold", 20); powerModeChangedDelay = reader.GetValueAsInt("atmolight", "powerModeChangedDelay", 5000); ambiBoxTarget = reader.GetValueAsBool("atmolight", "ambiBoxTarget", false); ambiBoxIP = reader.GetValueAsString("atmolight", "ambiBoxIP", "127.0.0.1"); ambiBoxPort = reader.GetValueAsInt("atmolight", "ambiBoxPort", 3636); ambiBoxMaxReconnectAttempts = reader.GetValueAsInt("atmolight", "ambiBoxMaxReconnectAttempts", 5); ambiBoxReconnectDelay = reader.GetValueAsInt("atmolight", "ambiBoxReconnectDelay", 5000); ambiBoxChangeImageDelay = reader.GetValueAsInt("atmolight", "ambiBoxChangeImageDelay", 10); ambiBoxMediaPortalProfile = reader.GetValueAsString("atmolight", "ambiBoxMediaPortalProfile", "MediaPortal"); ambiBoxExternalProfile = reader.GetValueAsString("atmolight", "ambiBoxExternalProfile", "External"); ambiBoxPath = reader.GetValueAsString("atmolight", "ambiBoxPath", "C:\\Program Files (x86)\\AmbiBox\\AmbiBox.exe"); ambiBoxAutoStart = reader.GetValueAsBool("atmolight", "ambiBoxAutoStart", false); ambiBoxAutoStop = reader.GetValueAsBool("atmolight", "ambiBoxAutoStop", false); atmoOrbTarget = reader.GetValueAsBool("atmolight", "atmoOrbTarget", false); atmoOrbBlackThreshold = reader.GetValueAsInt("atmolight", "atmoOrbBlackThreshold", 16); atmoOrbBroadcastPort = reader.GetValueAsInt("atmolight", "atmoOrbBroadcastPort", 49692); atmoOrbGamma = Double.Parse(reader.GetValueAsString("atmolight", "atmoOrbGamma", "1").Replace(",", "."), CultureInfo.InvariantCulture.NumberFormat); atmoOrbMinDiversion = reader.GetValueAsInt("atmolight", "atmoOrbMinDiversion", 16); atmoOrbSaturation = Double.Parse(reader.GetValueAsString("atmolight", "atmoOrbSaturation", "0.2").Replace(",", "."), CultureInfo.InvariantCulture.NumberFormat); atmoOrbThreshold = reader.GetValueAsInt("atmolight", "atmoOrbThreshold", 0); atmoOrbUseOverallLightness = reader.GetValueAsBool("atmolight", "atmoOrbUseOverallLightness", true); atmoOrbUseSmoothing = reader.GetValueAsBool("atmolight", "atmoOrbUseSmoothing", true); atmoOrbSmoothingThreshold = reader.GetValueAsInt("atmolight", "atmoOrbSmoothingThreshold", 200); string atmoOrbLampTemp = reader.GetValueAsString("atmolight", "atmoOrbLamps", ""); string[] atmoOrbLampTempSplit = atmoOrbLampTemp.Split('|'); for (int i = 0; i < atmoOrbLampTempSplit.Length; i++) { if (!string.IsNullOrEmpty(atmoOrbLampTempSplit[i])) { atmoOrbLamps.Add(atmoOrbLampTempSplit[i]); } } vuMeterMindB = reader.GetValueAsInt("atmolight", "vuMeterMindB", -24); vuMeterMinHue = Double.Parse(reader.GetValueAsString("atmolight", "vuMeterMinHue", "0,74999").Replace(",", "."), CultureInfo.InvariantCulture.NumberFormat); vuMeterMaxHue = Double.Parse(reader.GetValueAsString("atmolight", "vuMeterMaxHue", "0,95833").Replace(",", "."), CultureInfo.InvariantCulture.NumberFormat); hueThreshold = reader.GetValueAsInt("atmolight", "hueThreshold", 16); hueBlackThreshold = reader.GetValueAsInt("atmolight", "hueBlackThreshold", 16); hueMinDiversion = reader.GetValueAsInt("atmolight", "hueMinDiversion", 16); hueSaturation = Double.Parse(reader.GetValueAsString("atmolight", "hueSaturation", "0.2").Replace(",", "."), CultureInfo.InvariantCulture.NumberFormat); hueUseOverallLightness = reader.GetValueAsBool("atmolight", "hueUseOverallLightness", true); blackbarDetectionHorizontal = reader.GetValueAsBool("atmolight", "blackbarDetectionHorizontal", true); blackbarDetectionVertical = reader.GetValueAsBool("atmolight", "blackbarDetectionVertical", true); blackbarDetectionLinkAreas = reader.GetValueAsBool("atmolight", "blackbarDetectionLinkAreas", true); remoteApiServer = reader.GetValueAsBool("atmolight", "remoteApiServer", false); doNotShowConnectionErrorsDuringPlayback = reader.GetValueAsBool("atmolight", "doNotShowConnectionErrorsDuringPlayback", false); } }
public static void LoadSettings() { using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Config, "MediaPortal.xml"))) { // Legacy support // The effect settings were integers in the past, but now are strings. // In order to avoid a lot of people loosing their effect settings during an update, // we convert the old settings to the new ones. int effectVideoInt; if (int.TryParse(reader.GetValueAsString("atmolight", "effectVideo", "MediaPortalLiveMode"), out effectVideoInt)) { effectVideo = OldIntToNewContentEffect(effectVideoInt); SaveSpecificSetting("effectVideo", effectVideo.ToString()); } else { effectVideo = (ContentEffect)Enum.Parse(typeof(ContentEffect), reader.GetValueAsString("atmolight", "effectVideo", "MediaPortalLiveMode")); } int effectMusicInt; if (int.TryParse(reader.GetValueAsString("atmolight", "effectMusic", "LEDsDisabled"), out effectMusicInt)) { effectMusic = OldIntToNewContentEffect(effectMusicInt); SaveSpecificSetting("effectMusic", effectMusic.ToString()); } else { effectMusic = (ContentEffect)Enum.Parse(typeof(ContentEffect), reader.GetValueAsString("atmolight", "effectMusic", "LEDsDisabled")); } int effecRadioInt; if (int.TryParse(reader.GetValueAsString("atmolight", "effectRadio", "LEDsDisabled"), out effecRadioInt)) { effectRadio = OldIntToNewContentEffect(effecRadioInt); SaveSpecificSetting("effectRadio", effectRadio.ToString()); } else { effectRadio = (ContentEffect)Enum.Parse(typeof(ContentEffect), reader.GetValueAsString("atmolight", "effectRadio", "LEDsDisabled")); } int effectMenuInt; if (int.TryParse(reader.GetValueAsString("atmolight", "effectMenu", "LEDsDisabled"), out effectMenuInt)) { effectMenu = OldIntToNewContentEffect(effectMenuInt); SaveSpecificSetting("effectMenu", effectMenu.ToString()); } else { effectMenu = (ContentEffect)Enum.Parse(typeof(ContentEffect), reader.GetValueAsString("atmolight", "effectMenu", "LEDsDisabled")); } int effectMPExitInt; if (int.TryParse(reader.GetValueAsString("atmolight", "effectMPExit", "LEDsDisabled"), out effectMPExitInt)) { effectMPExit = OldIntToNewContentEffect(effectMPExitInt == 4 ? 5 : effectMPExitInt); SaveSpecificSetting("effectMPExit", effectMPExit.ToString()); } else { effectMPExit = (ContentEffect)Enum.Parse(typeof(ContentEffect), reader.GetValueAsString("atmolight", "effectMPExit", "LEDsDisabled")); } currentLanguageFile = reader.GetValueAsString("atmolight", "CurrentLanguageFile", Win32API.GetSpecialFolder(Win32API.CSIDL.CSIDL_COMMON_APPDATA) + "\\Team MediaPortal\\MediaPortal\\language\\AtmoLight\\en.xml"); if (currentLanguageFile.Substring(currentLanguageFile.Length - 3, 3).ToLower() == "lng") { int lastBackslash = currentLanguageFile.LastIndexOf("\\") + 1; int lastDot = currentLanguageFile.LastIndexOf("."); switch (currentLanguageFile.Substring(lastBackslash, lastDot - lastBackslash)) { case "GermanDE": currentLanguageFile = Win32API.GetSpecialFolder(Win32API.CSIDL.CSIDL_COMMON_APPDATA) + "\\Team MediaPortal\\MediaPortal\\language\\AtmoLight\\de.xml"; break; case "DutchNL": currentLanguageFile = Win32API.GetSpecialFolder(Win32API.CSIDL.CSIDL_COMMON_APPDATA) + "\\Team MediaPortal\\MediaPortal\\language\\AtmoLight\\nl.xml"; break; case "FrenchFR": currentLanguageFile = Win32API.GetSpecialFolder(Win32API.CSIDL.CSIDL_COMMON_APPDATA) + "\\Team MediaPortal\\MediaPortal\\language\\AtmoLight\\fr.xml"; break; default: case "EnglishUS": currentLanguageFile = Win32API.GetSpecialFolder(Win32API.CSIDL.CSIDL_COMMON_APPDATA) + "\\Team MediaPortal\\MediaPortal\\language\\AtmoLight\\en.xml"; break; } } // Normal settings loading atmowinExe = reader.GetValueAsString("atmolight", "atmowinexe", ""); killButton = reader.GetValueAsInt("atmolight", "killbutton", 4); profileButton = reader.GetValueAsInt("atmolight", "cmbutton", 4); menuButton = reader.GetValueAsInt("atmolight", "menubutton", 4); excludeTimeStart = LoadTimeSetting(reader, "excludeTimeStart", "00:00"); excludeTimeEnd = LoadTimeSetting(reader, "excludeTimeEnd", "00:00"); manualMode = reader.GetValueAsBool("atmolight", "OffOnStart", false); sbs3dOn = reader.GetValueAsBool("atmolight", "SBS_3D_ON", false); lowCPU = reader.GetValueAsBool("atmolight", "lowCPU", false); lowCPUTime = reader.GetValueAsInt("atmolight", "lowCPUTime", 0); delay = reader.GetValueAsBool("atmolight", "Delay", false); delayReferenceTime = reader.GetValueAsInt("atmolight", "DelayTime", 0); exitAtmoWin = reader.GetValueAsBool("atmolight", "ExitAtmoWin", true); startAtmoWin = reader.GetValueAsBool("atmolight", "StartAtmoWin", true); atmoWakeHelperEnabled = reader.GetValueAsBool("atmolight", "atmoWakeHelperEnabled", false); atmoWakeHelperComPort = reader.GetValueAsString("atmolight", "atmoWakeHelperComPort", ""); atmoWakeHelperResumeDelay = reader.GetValueAsInt("atmolight", "atmoWakeHelperResumeDelay", 2500); atmoWakeHelperDisconnectDelay = reader.GetValueAsInt("atmolight", "atmoWakeHelperDisconnectDelay", 1500); atmoWakeHelperConnectDelay = reader.GetValueAsInt("atmolight", "atmoWakeHelperConnectDelay", 1500); atmoWakeHelperReinitializationDelay = reader.GetValueAsInt("atmolight", "atmoWakeHelperReinitializationDelay", 0); staticColorRed = reader.GetValueAsInt("atmolight", "StaticColorRed", 0); staticColorGreen = reader.GetValueAsInt("atmolight", "StaticColorGreen", 0); staticColorBlue = reader.GetValueAsInt("atmolight", "StaticColorBlue", 0); restartOnError = reader.GetValueAsBool("atmolight", "RestartOnError", true); trueGrabbing = reader.GetValueAsBool("atmolight", "TrueGrabbing", true); delayReferenceRefreshRate = reader.GetValueAsInt("atmolight", "DelayRefreshRate", 50); blackbarDetection = reader.GetValueAsBool("atmolight", "BlackbarDetection", false); blackbarDetectionTime = reader.GetValueAsInt("atmolight", "BlackbarDetectionTime", 1000); gifFile = reader.GetValueAsString("atmolight", "GIFFile", ""); captureWidth = reader.GetValueAsInt("atmolight", "captureWidth", 64); captureHeight = reader.GetValueAsInt("atmolight", "captureHeight", 64); monitorScreensaverState = reader.GetValueAsBool("atmolight", "monitorScreensaverState", true); monitorWindowState = reader.GetValueAsBool("atmolight", "monitorWindowState", true); hyperionIP = reader.GetValueAsString("atmolight", "hyperionIP", "127.0.0.1"); hyperionPort = reader.GetValueAsInt("atmolight", "hyperionPort", 19445); hyperionReconnectDelay = reader.GetValueAsInt("atmolight", "hyperionReconnectDelay", 10000); hyperionReconnectAttempts = reader.GetValueAsInt("atmolight", "hyperionReconnectAttempts", 5); hyperionPriority = reader.GetValueAsInt("atmolight", "hyperionPriority", 1); hyperionPriorityStaticColor = reader.GetValueAsInt("atmolight", "hyperionStaticColorPriority", 1); hyperionLiveReconnect = reader.GetValueAsBool("atmolight", "hyperionLiveReconnect", false); hueExe = reader.GetValueAsString("atmolight", "hueExe", ""); hueStart = reader.GetValueAsBool("atmolight", "hueStart", true); hueIsRemoteMachine = reader.GetValueAsBool("atmolight", "hueIsRemoteMachine", false); hueIP = reader.GetValueAsString("atmolight", "hueIP", "127.0.0.1"); huePort = reader.GetValueAsInt("atmolight", "huePort", 20123); hueReconnectDelay = reader.GetValueAsInt("atmolight", "hueReconnectDelay", 10000); hueReconnectAttempts = reader.GetValueAsInt("atmolight", "hueReconnectAttempts", 5); hueBridgeEnableOnResume = reader.GetValueAsBool("atmolight", "hueBridgeEnableOnResume", false); hueBridgeDisableOnSuspend = reader.GetValueAsBool("atmolight", "hueBridgeDisableOnSuspend", false); hueTheaterEnabled = reader.GetValueAsBool("atmolight", "hueTheaterEnabled", false); hueTheaterRestoreLights = reader.GetValueAsBool("atmolight", "hueTheaterRestoreLights", false); boblightIP = reader.GetValueAsString("atmolight", "boblightIP", "127.0.0.1"); boblightPort = reader.GetValueAsInt("atmolight", "boblightPort", 19333); boblightMaxFPS = reader.GetValueAsInt("atmolight", "boblightMaxFPS", 10); boblightMaxReconnectAttempts = reader.GetValueAsInt("atmolight", "boblightMaxReconnectAttempts", 5); boblightReconnectDelay = reader.GetValueAsInt("atmolight", "boblightReconnectDelay", 5000); boblightSpeed = reader.GetValueAsInt("atmolight", "boblightSpeed", 100); boblightAutospeed = reader.GetValueAsInt("atmolight", "boblightAutospeed", 0); boblightInterpolation = reader.GetValueAsBool("atmolight", "boblightInterpolation", true); boblightSaturation = reader.GetValueAsInt("atmolight", "boblightSaturation", 1); boblightValue = reader.GetValueAsInt("atmolight", "boblightValue", 1); boblightThreshold = reader.GetValueAsInt("atmolight", "boblightThreshold", 20); boblightGamma = Double.Parse(reader.GetValueAsString("atmolight", "boblightGamma", "2.2").Replace(",", "."), CultureInfo.InvariantCulture.NumberFormat); atmoWinTarget = reader.GetValueAsBool("atmolight", "atmoWinTarget", true); boblightTarget = reader.GetValueAsBool("atmolight", "boblightTarget", false); hueTarget = reader.GetValueAsBool("atmolight", "hueTarget", false); hyperionTarget = reader.GetValueAsBool("atmolight", "hyperionTarget", false); blackbarDetectionThreshold = reader.GetValueAsInt("atmolight", "blackbarDetectionThreshold", 20); powerModeChangedDelay = reader.GetValueAsInt("atmolight", "powerModeChangedDelay", 5000); ambiBoxTarget = reader.GetValueAsBool("atmolight", "ambiBoxTarget", false); ambiBoxIP = reader.GetValueAsString("atmolight", "ambiBoxIP", "127.0.0.1"); ambiBoxPort = reader.GetValueAsInt("atmolight", "ambiBoxPort", 3636); ambiBoxMaxReconnectAttempts = reader.GetValueAsInt("atmolight", "ambiBoxMaxReconnectAttempts", 5); ambiBoxReconnectDelay = reader.GetValueAsInt("atmolight", "ambiBoxReconnectDelay", 5000); ambiBoxMediaPortalProfile = reader.GetValueAsString("atmolight", "ambiBoxMediaPortalProfile", "MediaPortal"); ambiBoxExternalProfile = reader.GetValueAsString("atmolight", "ambiBoxExternalProfile", "External"); ambiBoxPath = reader.GetValueAsString("atmolight", "ambiBoxPath", "C:\\Program Files (x86)\\AmbiBox\\AmbiBox.exe"); ambiBoxAutoStart = reader.GetValueAsBool("atmolight", "ambiBoxAutoStart", false); ambiBoxAutoStop = reader.GetValueAsBool("atmolight", "ambiBoxAutoStop", false); atmoOrbTarget = reader.GetValueAsBool("atmolight", "atmoOrbTarget", false); atmoOrbBlackThreshold = reader.GetValueAsInt("atmolight", "atmoOrbBlackThreshold", 16); atmoOrbBroadcastPort = reader.GetValueAsInt("atmolight", "atmoOrbBroadcastPort", 49692); atmoOrbGamma = Double.Parse(reader.GetValueAsString("atmolight", "atmoOrbGamma", "1").Replace(",", "."), CultureInfo.InvariantCulture.NumberFormat); atmoOrbMinDiversion = reader.GetValueAsInt("atmolight", "atmoOrbMinDiversion", 16); atmoOrbSaturation = Double.Parse(reader.GetValueAsString("atmolight", "atmoOrbSaturation", "0.2").Replace(",", "."), CultureInfo.InvariantCulture.NumberFormat); atmoOrbThreshold = reader.GetValueAsInt("atmolight", "atmoOrbThreshold", 0); atmoOrbUseOverallLightness = reader.GetValueAsBool("atmolight", "atmoOrbUseOverallLightness", true); string atmoOrbLampTemp = reader.GetValueAsString("atmolight", "atmoOrbLamps", ""); string[] atmoOrbLampTempSplit = atmoOrbLampTemp.Split('|'); for (int i = 0; i < atmoOrbLampTempSplit.Length; i++) { if (!string.IsNullOrEmpty(atmoOrbLampTempSplit[i])) { atmoOrbLamps.Add(atmoOrbLampTempSplit[i]); } } vuMeterMindB = reader.GetValueAsInt("atmolight", "vuMeterMindB", -24); vuMeterMinHue = Double.Parse(reader.GetValueAsString("atmolight", "vuMeterMinHue", "0,74999").Replace(",", "."), CultureInfo.InvariantCulture.NumberFormat); vuMeterMaxHue = Double.Parse(reader.GetValueAsString("atmolight", "vuMeterMaxHue", "0,95833").Replace(",", "."), CultureInfo.InvariantCulture.NumberFormat); hueThreshold = reader.GetValueAsInt("atmolight", "hueThreshold", 16); hueBlackThreshold = reader.GetValueAsInt("atmolight", "hueBlackThreshold", 16); hueMinDiversion = reader.GetValueAsInt("atmolight", "hueMinDiversion", 16); hueSaturation = Double.Parse(reader.GetValueAsString("atmolight", "hueSaturation", "0.2").Replace(",", "."), CultureInfo.InvariantCulture.NumberFormat); hueUseOverallLightness = reader.GetValueAsBool("atmolight", "hueUseOverallLightness", true); blackbarDetectionHorizontal = reader.GetValueAsBool("atmolight", "blackbarDetectionHorizontal", true); blackbarDetectionVertical = reader.GetValueAsBool("atmolight", "blackbarDetectionVertical", true); blackbarDetectionLinkAreas = reader.GetValueAsBool("atmolight", "blackbarDetectionLinkAreas", true); remoteApiServer = reader.GetValueAsBool("atmolight", "remoteApiServer", false); } }