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"); } }
// Save settings to file private void btSave_Click(object sender, EventArgs e) { using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "Avalon.xml"))) { if (configloaded) { int a = 0; do { xmlwriter.RemoveEntry("AvalonBasicHome", "menuItemName" + a); xmlwriter.RemoveEntry("AvalonBasicHome", "menuItemHyperlink" + a); xmlwriter.RemoveEntry("AvalonBasicHome", "AvalonBasicHomeSubmenu" + a); xmlwriter.RemoveEntry("AvalonBasicHome", "menuItemBgImage" + a); xmlwriter.RemoveEntry("AvalonBasicHome", "menuItemParameter" + a); xmlwriter.RemoveEntry("AvalonBasicHome", "menuItemRecentMedia" + a); int b = 0; do { xmlwriter.RemoveEntry("AvalonBasicHomeSubmenu" + a, "submenuItemName" + b); xmlwriter.RemoveEntry("AvalonBasicHomeSubmenu" + a, "submenuItemHyperlink" + b); xmlwriter.RemoveEntry("AvalonBasicHomeSubmenu" + a, "submenuItemBgImage" + b); xmlwriter.RemoveEntry("AvalonBasicHomeSubmenu" + a, "submenuItemParameter" + b); xmlwriter.RemoveEntry("AvalonBasicHomeSubmenu" + a, "submenuItemRecentMedia" + b); b++; } while (b < 250); a++; } while (a < 25); } int mycount = 0; //menuItems.Sort(delegate(menuItem li1, menuItem li2) { return li1.identifier.CompareTo(li2.identifier); }); foreach (menuItem item in menuItems) { xmlwriter.SetValue("AvalonBasicHome", "menuItemName" + mycount, item.name); xmlwriter.SetValue("AvalonBasicHome", "menuItemHyperlink" + mycount, item.hyperlink); if (item.bgImage != string.Empty) { xmlwriter.SetValue("AvalonBasicHome", "menuItemBgImage" + mycount, item.bgImage); } if (item.property != string.Empty) { xmlwriter.SetValue("AvalonBasicHome", "menuItemParameter" + mycount, item.property); } if (item.media != string.Empty) { xmlwriter.SetValue("AvalonBasicHome", "menuItemRecentMedia" + mycount, item.media); } int mycount2 = 0; foreach (Child mychild in singleChildren) { if (item.identifier == mychild.Owner) { xmlwriter.SetValue("AvalonBasicHomeSubmenu" + mycount, "submenuItemName" + mycount2, mychild.Name); xmlwriter.SetValue("AvalonBasicHomeSubmenu" + mycount, "submenuItemHyperlink" + mycount2, mychild.Hyperlink); if (mychild.property != string.Empty) { xmlwriter.SetValue("AvalonBasicHomeSubmenu" + mycount, "submenuItemParameter" + mycount2, mychild.property); } mycount2++; } } mycount++; } } this.Close(); }
public static void SaveSettings() { using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Config, "MediaPortal.xml"))) { reader.SetValue("atmolight", "atmowinexe", atmowinExe); reader.SetValue("atmolight", "effectVideo", effectVideo.ToString()); reader.SetValue("atmolight", "effectMusic", effectMusic.ToString()); reader.SetValue("atmolight", "effectRadio", effectRadio.ToString()); reader.SetValue("atmolight", "effectMenu", effectMenu.ToString()); reader.SetValue("atmolight", "effectMPExit", effectMPExit.ToString()); reader.SetValue("atmolight", "killbutton", (int)killButton); reader.SetValue("atmolight", "cmbutton", (int)profileButton); reader.SetValue("atmolight", "menubutton", (int)menuButton); reader.SetValueAsBool("atmolight", "OffOnStart", manualMode); reader.SetValueAsBool("atmolight", "SBS_3D_ON", sbs3dOn); reader.SetValueAsBool("atmolight", "lowCPU", lowCPU); reader.SetValue("atmolight", "lowCPUTime", lowCPUTime); reader.SetValueAsBool("atmolight", "Delay", delay); reader.SetValue("atmolight", "DelayTime", delayReferenceTime); reader.SetValue("atmolight", "DelayRefreshRate", delayReferenceRefreshRate); reader.SetValue("atmolight", "DelayTime23", delayReferenceTime23); reader.SetValue("atmolight", "DelayTime24", delayReferenceTime24); reader.SetValue("atmolight", "DelayTime50", delayReferenceTime50); reader.SetValue("atmolight", "DelayTime59", delayReferenceTime59); reader.SetValueAsBool("atmolight", "ExitAtmoWin", exitAtmoWin); reader.SetValueAsBool("atmolight", "StartAtmoWin", startAtmoWin); reader.SetValueAsBool("atmolight", "atmoWakeHelperEnabled", atmoWakeHelperEnabled); reader.SetValue("atmolight", "atmoWakeHelperComPort", atmoWakeHelperComPort); reader.SetValue("atmolight", "atmoWakeHelperResumeDelay", atmoWakeHelperResumeDelay); reader.SetValue("atmolight", "atmoWakeHelperDisconnectDelay", atmoWakeHelperDisconnectDelay); reader.SetValue("atmolight", "atmoWakeHelperConnectDelay", atmoWakeHelperConnectDelay); reader.SetValue("atmolight", "atmoWakeHelperReinitializationDelay", atmoWakeHelperReinitializationDelay); reader.SetValue("atmolight", "excludeTimeStart", excludeTimeStart.ToString("HH:mm")); reader.SetValue("atmolight", "excludeTimeEnd", excludeTimeEnd.ToString("HH:mm")); reader.SetValue("atmolight", "currentLanguage", currentLanguage); reader.RemoveEntry("atmolight", "currentLanguageFile"); reader.SetValue("atmolight", "StaticColorRed", staticColorRed); reader.SetValue("atmolight", "StaticColorGreen", staticColorGreen); reader.SetValue("atmolight", "StaticColorBlue", staticColorBlue); reader.SetValueAsBool("atmolight", "RestartOnError", restartOnError); reader.SetValueAsBool("atmolight", "TrueGrabbing", trueGrabbing); reader.SetValueAsBool("atmolight", "BlackbarDetection", blackbarDetection); reader.SetValue("atmolight", "BlackbarDetectionTime", blackbarDetectionTime); reader.SetValue("atmolight", "GIFFile", gifFile); reader.SetValue("atmolight", "captureWidth", (int)captureWidth); reader.SetValue("atmolight", "captureHeight", (int)captureHeight); reader.SetValueAsBool("atmolight", "monitorScreensaverState", monitorScreensaverState); reader.SetValueAsBool("atmolight", "monitorWindowState", monitorWindowState); reader.SetValue("atmolight", "hyperionIP", hyperionIP); reader.SetValue("atmolight", "hyperionPort", (int)hyperionPort); reader.SetValue("atmolight", "hyperionPriority", (int)hyperionPriority); reader.SetValue("atmolight", "hyperionReconnectDelay", (int)hyperionReconnectDelay); reader.SetValue("atmolight", "hyperionReconnectAttempts", (int)hyperionReconnectAttempts); reader.SetValue("atmolight", "hyperionStaticColorPriority", (int)hyperionPriorityStaticColor); reader.SetValueAsBool("atmolight", "hyperionLiveReconnect", hyperionLiveReconnect); reader.SetValue("atmolight", "hueExe", hueExe); reader.SetValueAsBool("atmolight", "hueStart", hueStart); reader.SetValueAsBool("atmolight", "hueIsRemoteMachine", hueIsRemoteMachine); reader.SetValue("atmolight", "hueIP", hueIP); reader.SetValue("atmolight", "huePort", (int)huePort); reader.SetValue("atmolight", "hueReconnectDelay", (int)hueReconnectDelay); reader.SetValue("atmolight", "hueReconnectAttempts", (int)hueReconnectAttempts); reader.SetValueAsBool("atmolight", "hueBridgeEnableOnResume", hueBridgeEnableOnResume); reader.SetValueAsBool("atmolight", "hueBridgeDisableOnSuspend", hueBridgeDisableOnSuspend); reader.SetValueAsBool("atmolight", "hueTheaterEnabled", hueTheaterEnabled); reader.SetValueAsBool("atmolight", "hueTheaterRestoreLights", hueTheaterRestoreLights); reader.SetValueAsBool("atmolight", "hueTheaterEnabledVU", hueTheaterEnabledVU); reader.SetValue("atmolight", "boblightIP", boblightIP); reader.SetValue("atmolight", "boblightPort", boblightPort); reader.SetValue("atmolight", "boblightMaxFPS", boblightMaxFPS); reader.SetValue("atmolight", "boblightMaxReconnectAttempts", boblightMaxReconnectAttempts); reader.SetValue("atmolight", "boblightReconnectDelay", boblightReconnectDelay); reader.SetValue("atmolight", "boblightSpeed", boblightSpeed); reader.SetValue("atmolight", "boblightAutospeed", boblightAutospeed); reader.SetValue("atmolight", "boblightSaturation", boblightSaturation); reader.SetValue("atmolight", "boblightValue", boblightValue); reader.SetValue("atmolight", "boblightThreshold", boblightThreshold); reader.SetValueAsBool("atmolight", "boblightInterpolation", boblightInterpolation); reader.SetValue("atmolight", "boblightGamma", boblightGamma.ToString()); reader.SetValue("atmolight", "blackbarDetectionThreshold", blackbarDetectionThreshold.ToString()); reader.SetValue("atmolight", "powerModeChangedDelay", powerModeChangedDelay.ToString()); reader.SetValue("atmolight", "ambiBoxIP", ambiBoxIP.ToString()); reader.SetValue("atmolight", "ambiBoxPort", ambiBoxPort.ToString()); reader.SetValue("atmolight", "ambiBoxMaxReconnectAttempts", ambiBoxMaxReconnectAttempts.ToString()); reader.SetValue("atmolight", "ambiBoxReconnectDelay", ambiBoxReconnectDelay.ToString()); reader.SetValue("atmolight", "ambiBoxChangeImageDelay", ambiBoxChangeImageDelay.ToString()); reader.SetValue("atmolight", "ambiBoxMediaPortalProfile", ambiBoxMediaPortalProfile.ToString()); reader.SetValue("atmolight", "ambiBoxExternalProfile", ambiBoxExternalProfile.ToString()); reader.SetValue("atmolight", "ambiBoxPath", ambiBoxPath.ToString()); reader.SetValueAsBool("atmolight", "ambiBoxAutoStart", ambiBoxAutoStart); reader.SetValueAsBool("atmolight", "ambiBoxAutoStop", ambiBoxAutoStop); reader.SetValue("atmolight", "vuMeterMindB", vuMeterMindB.ToString()); reader.SetValue("atmolight", "vuMeterMinHue", vuMeterMinHue.ToString()); reader.SetValue("atmolight", "vuMeterMaxHue", vuMeterMaxHue.ToString()); reader.SetValueAsBool("atmolight", "atmoWinTarget", atmoWinTarget); reader.SetValueAsBool("atmolight", "boblightTarget", boblightTarget); reader.SetValueAsBool("atmolight", "hueTarget", hueTarget); reader.SetValueAsBool("atmolight", "hyperionTarget", hyperionTarget); reader.SetValueAsBool("atmolight", "ambiBoxTarget", ambiBoxTarget); reader.SetValueAsBool("atmolight", "atmoOrbTarget", atmoOrbTarget); reader.SetValue("atmolight", "atmoOrbBlackThreshold", atmoOrbBlackThreshold.ToString()); reader.SetValue("atmolight", "atmoOrbBroadcastPort", atmoOrbBroadcastPort.ToString()); reader.SetValue("atmolight", "atmoOrbGamma", atmoOrbGamma.ToString()); reader.SetValue("atmolight", "atmoOrbMinDiversion", atmoOrbMinDiversion.ToString()); reader.SetValue("atmolight", "atmoOrbSaturation", atmoOrbSaturation.ToString()); reader.SetValue("atmolight", "atmoOrbThreshold", atmoOrbThreshold.ToString()); reader.SetValueAsBool("atmolight", "atmoOrbUseOverallLightness", atmoOrbUseOverallLightness); reader.SetValueAsBool("atmolight", "atmoOrbUseSmoothing", atmoOrbUseSmoothing); reader.SetValue("atmolight", "atmoOrbSmoothingThreshold", atmoOrbSmoothingThreshold.ToString()); string atmoOrbLampsTemp = ""; for (int i = 0; i < atmoOrbLamps.Count; i++) { if (i > 0) { atmoOrbLampsTemp += "|"; } atmoOrbLampsTemp += atmoOrbLamps[i]; } reader.SetValue("atmolight", "atmoOrbLamps", atmoOrbLampsTemp); reader.SetValue("atmolight", "hueMinDiversion", hueMinDiversion.ToString()); reader.SetValue("atmolight", "hueThreshold", hueThreshold.ToString()); reader.SetValue("atmolight", "hueBlackThreshold", hueBlackThreshold.ToString()); reader.SetValue("atmolight", "hueSaturation", hueSaturation.ToString()); reader.SetValueAsBool("atmolight", "hueUseOverallLightness", hueUseOverallLightness); reader.SetValueAsBool("atmolight", "blackbarDetectionHorizontal", blackbarDetectionHorizontal); reader.SetValueAsBool("atmolight", "blackbarDetectionVertical", blackbarDetectionVertical); reader.SetValueAsBool("atmolight", "blackbarDetectionLinkAreas", blackbarDetectionLinkAreas); reader.SetValueAsBool("atmolight", "remoteApiServer", remoteApiServer); reader.SetValueAsBool("atmolight", "doNotShowConnectionErrorsDuringPlayback", doNotShowConnectionErrorsDuringPlayback); } }