public void SaveSettings(string ExportFileName) { string tmpConfigFileName = Config.GetFile(Config.Dir.Config, "ViewModeSwitcher.xml"); if (ExportFileName != string.Empty) { tmpConfigFileName = ExportFileName; } using (Settings xmlwriter = new Settings(tmpConfigFileName)) { xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmDisableLBGlobaly, DisableLBGlobaly); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmVerboselog, verboseLog); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmShowSwitchMsg, ShowSwitchMsg); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmUseFallbackRule, UseFallbackRule); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmFallbackViewMode, FallBackViewMode.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRuleCount, ViewModeRules.Count.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmBlackLevel, LBBlackLevel.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, FallBackOverScan, fboverScan.ToString()); for (int i = 1; i <= ViewModeRules.Count; i++) { Rule tmpRule = ViewModeRules[i - 1]; xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i + "Enabled", tmpRule.Enabled); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "Name", tmpRule.Name); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "ARFrom", tmpRule.ARFrom.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "ARTo", tmpRule.ARTo.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "MinWidth", tmpRule.MinWidth.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "MaxWidth", tmpRule.MaxWidth.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "MinHeight", tmpRule.MinHeight.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "MaxHeight", tmpRule.MaxHeight.ToString()); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i + "ChangeAR", tmpRule.ChangeAR); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "ViewMode", tmpRule.ViewMode.ToString()); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i + "ChangeOS", tmpRule.ChangeOs); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "Overscan", tmpRule.OverScan.ToString()); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i + "EnableLBDetection", tmpRule.EnableLBDetection); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "VerticalOffSetZoom", tmpRule.VerticalOffSetZoom.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "VerticalOffSet14_9", tmpRule.VerticalOffSet14_9.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "VerticalOffSetWide14_9", tmpRule.VerticalOffSetWide14_9.ToString()); } if (ExportFileName != string.Empty) { Settings.SaveCache(); } } }
public void SaveSettings(string ExportFileName) { string tmpConfigFileName = Config.GetFile(Config.Dir.Config, SettingsFileName); if (ExportFileName != string.Empty) { tmpConfigFileName = ExportFileName; } using (Settings xmlwriter = new Settings(tmpConfigFileName)) { xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmDisableLBGlobaly, DisableLBGlobaly); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmVerboselog, verboseLog); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmShowSwitchMsg, ShowSwitchMsg); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmUseFallbackRule, UseFallbackRule); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmDisableForVideo, disableForVideo); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmDisableLBForVideo, disableLBForVideo); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmFallbackViewMode, FallBackViewMode.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRuleCount, ViewModeRules.Count.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmBlackLevel, LBMaxBlackLevel.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, FallBackOverScan, fboverScan.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmMinBlackLevel, LBMinBlackLevel.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmSymLimitPercent, LBSymLimitPercent.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmLBdetectInterval, LBdetectInterval.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmMaxCropLimitPercent, LBMaxCropLimitPercent.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmDetectWidthPercent, DetectWidthPercent.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmDetectHeightPercent, DetectHeightPercent.ToString()); for (int i = 1; i <= ViewModeRules.Count; i++) { Rule tmpRule = ViewModeRules[i - 1]; xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i + "Enabled", tmpRule.Enabled); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "Name", tmpRule.Name); int tmpARFrom = Convert.ToInt32(tmpRule.ARFrom * 1000.0); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "ARFromX1000", tmpARFrom.ToString()); int tmpARTo = Convert.ToInt32(tmpRule.ARTo * 1000.0); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "ARToX1000", tmpARTo.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "MinWidth", tmpRule.MinWidth.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "MaxWidth", tmpRule.MaxWidth.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "MinHeight", tmpRule.MinHeight.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "MaxHeight", tmpRule.MaxHeight.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "ViewMode", tmpRule.ViewMode.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i + "Overscan", tmpRule.OverScan.ToString()); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i + "EnableLBDetection", tmpRule.EnableLBDetection); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i + "AutoCrop", tmpRule.AutoCrop); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i + "MaxCrop", tmpRule.MaxCrop); } if (ExportFileName != string.Empty) { Settings.SaveCache(); } } }