本文整理汇总了C#中Settings.GetValueAsBool方法的典型用法代码示例。如果您正苦于以下问题:C# Settings.GetValueAsBool方法的具体用法?C# Settings.GetValueAsBool怎么用?C# Settings.GetValueAsBool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings.GetValueAsBool方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EventGhostPlus
public EventGhostPlus()
{
SystemStandby = false;
Sending = false;
using (Settings xmlReader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
{
egPath = xmlReader.GetValueAsString(PLUGIN_NAME, "egPath", "");
egPart2 = xmlReader.GetValueAsString(PLUGIN_NAME, "egPart2", "Type");
egPart3 = xmlReader.GetValueAsString(PLUGIN_NAME, "egPart3", "Status");
egPayload = xmlReader.GetValueAsBool(PLUGIN_NAME, "egPayload", false);
WindowChange = xmlReader.GetValueAsBool(PLUGIN_NAME, "WindowChange", false);
isTcpip = xmlReader.GetValueAsBool(PLUGIN_NAME, "tcpipIsEnabled", false);
Host = xmlReader.GetValueAsString(PLUGIN_NAME, "tcpipHost", "");
Port = xmlReader.GetValueAsString(PLUGIN_NAME, "tcpipPort", "");
Password = xmlReader.GetValueAsString(PLUGIN_NAME, "tcpipPassword", "");
PWDEncrypted = xmlReader.GetValueAsBool(PLUGIN_NAME, "PWDEncrypted", false);
rcvPort = xmlReader.GetValueAsString(PLUGIN_NAME, "ReceivePort", "1023");
rcvPassword = xmlReader.GetValueAsString(PLUGIN_NAME, "ReceivePassword", "");
setLevelForMediaDuration = xmlReader.GetValueAsInt(PLUGIN_NAME, "setLevelForMediaDuration", 10);
DebugMode = xmlReader.GetValueAsBool(PLUGIN_NAME, "DebugMode", false);
}
egStartInfo.CreateNoWindow = false;
egStartInfo.UseShellExecute = true;
if (DebugMode) Logger.Debug("EventGhost path: " + @egPath + @"\EventGhost.exe");
egStartInfo.FileName = @egPath + @"\EventGhost.exe";
egStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
DialogBusy = false;
}
示例2: LoadAdvancedSettings
protected override void LoadAdvancedSettings(Settings xmlreader)
{
int subPicsBufferAhead = xmlreader.GetValueAsInt("subtitles", "subPicsBufferAhead", 3);
bool pow2textures = xmlreader.GetValueAsBool("subtitles", "pow2tex", false);
string textureSize = xmlreader.GetValueAsString("subtitles", "textureSize", "Medium");
bool disableAnimation = xmlreader.GetValueAsBool("subtitles", "disableAnimation", true);
int w, h;
int screenW = GUIGraphicsContext.Width;
int screenH = GUIGraphicsContext.Height;
bool res1080 = (screenW == 1920 && screenH == 1080);
bool res720 = (screenW >= 1280 && screenW <= 1368 && screenH >= 720 && screenH <= 768);
if (textureSize.Equals("Desktop"))
{
w = screenW;
h = screenH;
}
else if (textureSize.Equals("Low"))
{
if (res1080)
{
w = 854;
h = 480;
}
else if (res720)
{
w = 512;
h = 288;
}
else
{
w = (int)(Math.Round(screenW / 3.0));
h = (int)(Math.Round(screenH / 3.0));
}
}
else //if (textureSize.Equals("Medium"))
{
if (res1080)
{
w = 1280;
h = 720;
}
else if (res720)
{
w = 854;
h = 480;
}
else
{
w = (int)(Math.Round(screenW * 2.0 / 3));
h = (int)(Math.Round(screenH * 2.0 / 3));
}
}
Log.Debug("MpcEngine: using texture size of {0}x{1}", w, h);
Size size = new Size(w, h);
MpcSubtitles.SetAdvancedOptions(subPicsBufferAhead, size, pow2textures, disableAnimation);
}
示例3: InputHandler
/// <summary>
/// Constructor: Initializes mappings from XML file
/// </summary>
/// <param name="deviceXmlName">Input device name</param>
public InputHandler(string deviceXmlName)
{
using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
_basicHome = xmlreader.GetValueAsBool("general", "startbasichome", false);
string xmlPath = GetXmlPath(deviceXmlName);
LoadMapping(xmlPath);
}
示例4: Load
public void Load(Settings xmlreader)
{
fontName = xmlreader.GetValueAsString("subtitles", "fontface", "Arial");
fontSize = xmlreader.GetValueAsInt("subtitles", "fontsize", 18);
fontIsBold = xmlreader.GetValueAsBool("subtitles", "bold", true);
fontCharset = xmlreader.GetValueAsInt("subtitles", "charset", 1); //default charset
string strColor = xmlreader.GetValueAsString("subtitles", "color", "ffffff");
int argb = Int32.Parse(strColor, System.Globalization.NumberStyles.HexNumber);
//convert ARGB to BGR (COLORREF)
fontColor = (int)((argb & 0x000000FF) << 16) |
(int)(argb & 0x0000FF00) |
(int)((argb & 0x00FF0000) >> 16);
shadow = xmlreader.GetValueAsInt("subtitles", "shadow", 3);
borderWidth = xmlreader.GetValueAsInt("subtitles", "borderWidth", 2);
isBorderOutline = xmlreader.GetValueAsBool("subtitles", "borderOutline", true);
}
示例5: Scraper
static Scraper()
{
using (var xmlreader = new Settings(Config.GetFile((Config.Dir) 10, "MediaPortal.xml")))
{
_strippedPrefixes = xmlreader.GetValueAsBool("musicfiles", "stripartistprefixes", false);
_artistPrefixes = xmlreader.GetValueAsString("musicfiles", "artistprefixes", "The, Les, Die");
}
logger.Debug("Initialize MP stripped prefixes: " + _artistPrefixes + " - " + (_strippedPrefixes ? "True" : "False"));
}
示例6: LoadMediaPortalXml
public static List<String> LoadMediaPortalXml()
{
List<String> AvailableModes = new List<String>();
using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
{
if (xmlreader.GetValueAsBool("mytv", "allowarnormal", true))
{
AvailableModes.Add(Geometry.Type.Normal.ToString());
}
if (xmlreader.GetValueAsBool("mytv", "allowaroriginal", true))
{
AvailableModes.Add(Geometry.Type.Original.ToString());
}
if (xmlreader.GetValueAsBool("mytv", "allowarzoom", true))
{
AvailableModes.Add(Geometry.Type.Zoom.ToString());
}
if (xmlreader.GetValueAsBool("mytv", "allowarzoom149", true))
{
AvailableModes.Add(Geometry.Type.Zoom14to9.ToString());
}
if (xmlreader.GetValueAsBool("mytv", "allowarstretch", true))
{
AvailableModes.Add(Geometry.Type.Stretch.ToString());
}
if (xmlreader.GetValueAsBool("mytv", "allowarnonlinear", true))
{
AvailableModes.Add(Geometry.Type.NonLinearStretch.ToString());
}
if (xmlreader.GetValueAsBool("mytv", "allowarletterbox", true))
{
AvailableModes.Add(Geometry.Type.LetterBox43.ToString());
}
}
return AvailableModes;
}
示例7: Execute
/// <summary>
/// Execute this command.
/// </summary>
/// <param name="variables">The variable list of the calling code.</param>
public override void Execute(VariableList variables)
{
bool mpBasicHome = false;
using (Settings xmlreader = new Settings(MPCommon.MPConfigFile))
mpBasicHome = xmlreader.GetValueAsBool("general", "startbasichome", false);
GUIGraphicsContext.ResetLastActivity();
// Stop all media before suspending
g_Player.Stop();
GUIMessage msg;
if (mpBasicHome)
msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0,
(int) GUIWindow.Window.WINDOW_SECOND_HOME, 0, null);
else
msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, (int) GUIWindow.Window.WINDOW_HOME, 0,
null);
GUIWindowManager.SendThreadMessage(msg);
WindowsController.ExitWindows(RestartOptions.Suspend, false);
}
示例8: LoadSettings
/// <summary>
/// Loads the settings.
/// </summary>
private static void LoadSettings()
{
try
{
using (Settings xmlreader = new Settings(MPCommon.MPConfigFile))
{
ServerHost = xmlreader.GetValueAsString("TV2BlasterPlugin", "ServerHost", "localhost");
// MediaPortal settings ...
_mpBasicHome = xmlreader.GetValueAsBool("general", "startbasichome", false);
}
}
catch (Exception ex)
{
Log.Error(ex);
}
}
示例9: Sites
public Sites(string strType)
{
try
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Plugins) + @"\Windows\Sites.xml");
if (xmlDoc.SelectSingleNode("sites/site") != null)
{
List<GUIListItem> _Items = new List<GUIListItem>();
foreach (XmlNode nodeItem in xmlDoc.SelectNodes("sites/site"))
{
switch (strType)
{
case "Feeds":
if (nodeItem.SelectNodes("feeds").Count != 0)
{
if (nodeItem.SelectSingleNode("login") != null)
{
if ((nodeItem["login"].Attributes["username"].InnerText.Length != 0) && (nodeItem["login"].Attributes["password"].InnerText.Length != 0))
{
_Items.Add(new GUIListItem(nodeItem.Attributes["name"].InnerText));
}
}
else
{
_Items.Add(new GUIListItem(nodeItem.Attributes["name"].InnerText));
}
}
break;
case "Search":
if (nodeItem.SelectNodes("searches").Count != 0)
{
if (nodeItem.SelectSingleNode("login") != null)
{
if ((nodeItem["login"].Attributes["username"].InnerText.Length != 0) && (nodeItem["login"].Attributes["password"].InnerText.Length != 0))
{
_Items.Add(new GUIListItem(nodeItem.Attributes["name"].InnerText));
}
}
else
{
_Items.Add(new GUIListItem(nodeItem.Attributes["name"].InnerText));
}
}
break;
case "Groups":
if (nodeItem.SelectSingleNode("groups") != null)
{
if (nodeItem.SelectSingleNode("login") != null)
{
if ((nodeItem["login"].Attributes["username"].InnerText.Length != 0) && (nodeItem["login"].Attributes["password"].InnerText.Length != 0))
{
_Items.Add(new GUIListItem(nodeItem.Attributes["name"].InnerText));
}
}
else
{
_Items.Add(new GUIListItem(nodeItem.Attributes["name"].InnerText));
}
}
break;
}
}
if (_Items.Count > 0)
{
GUIListItem _Item = MP.Menu(_Items, "Select Site");
if (_Item != null)
{
SiteName = _Item.Label;
if (xmlDoc.SelectSingleNode("sites/site[@name='" + SiteName + "']/login") != null)
{
Username = xmlDoc.SelectSingleNode("sites/site[@name='" + SiteName + "']/login").Attributes["username"].InnerText;
Password = xmlDoc.SelectSingleNode("sites/site[@name='" + SiteName + "']/login").Attributes["password"].InnerText;
}
}
}
}
else
{
GUIPropertyManager.SetProperty("#Status", "Error parsing XML");
}
Settings mpSettings = new Settings(MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + @"\mpNZB.xml");
MaxResults = mpSettings.GetValueAsInt("#Sites", "MaxResults", 50);
if (MaxResults == 0) { MaxResults = 50; }
MPTVSeries = mpSettings.GetValueAsBool("#Sites", "MPTVSeries", false);
mpSettings.Dispose();
}
catch (Exception e) { MP.Error(e); }
}
示例10: OnPageLoad
protected override void OnPageLoad()
{
try
{
// Set "Status" label
GUIPropertyManager.SetProperty("#Status", "Idle");
// Disable "Refresh Feed" button
btnRefresh.Disabled = true;
// Load Settings
Settings mpSettings = new Settings(MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + @"\mpNZB.xml");
// Setup Page Title
// ##################################################
string strPageTitle = mpSettings.GetValue("#Plugin", "DisplayName");
GUIPropertyManager.SetProperty("#PageTitle", ((strPageTitle.Length == 0) ? "mpNZB" : strPageTitle));
// ##################################################
// Setup Client
// ##################################################
switch (mpSettings.GetValue("#Client", "Grabber"))
{
case "SABnzbd":
{
Client = new Clients.SABnzbd(mpSettings.GetValue("#Client", "Host"), mpSettings.GetValue("#Client", "Port"), mpSettings.GetValueAsBool("#Client", "CatSelect", false), mpSettings.GetValueAsBool("#Client", "Auth", false), mpSettings.GetValue("#Client", "Username"), mpSettings.GetValue("#Client", "Password"), mpSettings.GetValue("#Client", "APIKey"), mpSettings.GetValueAsInt("#Plugin", "UpdateFrequency", 1), mpSettings.GetValueAsBool("#Plugin", "Notifications", false), mpSettings.GetValueAsInt("#Plugin", "AutoHideSeconds", 0), mpSettings.GetValueAsBool("#Client", "Https", false));
string strVersion = Client.Version();
if (strVersion.Length != 0)
{
GUIPropertyManager.SetProperty("#Status", "Idle (" + strVersion + ")");
}
else
{
GUIPropertyManager.SetProperty("#Status", "SABnzbd connection failed");
return;
}
break;
}
}
tmrStatus = new Timer();
tmrStatus.Elapsed += new System.Timers.ElapsedEventHandler(OnTimer);
tmrStatus.Interval = (mpSettings.GetValueAsInt("#Plugin", "UpdateFrequency", 1) * 1000);
tmrStatus.Enabled = true;
// ##################################################
// Unload Settings
mpSettings.Dispose();
// Update Status
Client.Visible = true;
Client.Status();
if (Client.Paused) { btnPause.Selected = true; }
// Load queue
Client.Queue(lstItems, this, true);
Client.ActiveView = (int)ClientView.Queue;
// Start with parameter
// Working at the moment:
// "search:string to search"
string loadParam = null;
// check if running version of mediaportal supports loading with parameter and handle _loadParameter
System.Reflection.FieldInfo fi = typeof(GUIWindow).GetField("_loadParameter", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
if (fi != null)
{
loadParam = (string)fi.GetValue(this);
}
if (!string.IsNullOrEmpty(loadParam))
{
Log.Debug("[MPNZB] Loading with param: " + loadParam);
string search = Regex.Match(loadParam, "search:([^|]*)").Groups[1].Value;
if (!string.IsNullOrEmpty(search))
{
SelectSite("Search", search);
}
}
}
catch (Exception e) { MP.Error(e); }
}
示例11: frmSetup_Load
private void frmSetup_Load(object sender, EventArgs e)
{
// Set Defaults
cmbGrabber.Text = "SABnzbd";
chkCatSelect.Enabled = true;
txtHost.Text = "127.0.0.1";
txtPort.Text = "8080";
txtUpdateFreq.Text = "1";
numericUpDownAutoHide.Value = 0;
if (File.Exists(MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + @"\mpNZB.xml"))
{
Settings mpSettings = new Settings(MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + @"\mpNZB.xml");
// Plugin Settings
// ##################################################
int intUpdate = mpSettings.GetValueAsInt("#Plugin", "UpdateFrequency", 1);
if (intUpdate > 0) { txtUpdateFreq.Text = intUpdate.ToString(); }
txtDisplayName.Text = mpSettings.GetValue("#Plugin", "DisplayName");
chkNotifications.Checked = mpSettings.GetValueAsBool("#Plugin", "Notifications", false);
int intAutohide = mpSettings.GetValueAsInt("#Plugin", "AutoHideSeconds", 0);
if (intUpdate > 0) { numericUpDownAutoHide.Value = intAutohide; }
// ##################################################
// Client Settings
// ##################################################
string strGrabber = mpSettings.GetValue("#Client", "Grabber");
if (strGrabber.Length > 0) { cmbGrabber.Text = strGrabber; }
string strHost = mpSettings.GetValue("#Client", "Host");
if (strHost.Length > 0) { txtHost.Text = strHost; }
string strPort = mpSettings.GetValue("#Client", "Port");
if (strPort.Length > 0) { txtPort.Text = strPort; }
checkBoxHttps.Checked = mpSettings.GetValueAsBool("#Client", "Https", false);
chkCatSelect.Enabled = (cmbGrabber.Text == "SABnzbd");
chkCatSelect.Checked = mpSettings.GetValueAsBool("#Client", "CatSelect", false);
chkAuth.Checked = mpSettings.GetValueAsBool("#Client", "Auth", false);
txtUsername.Enabled = chkAuth.Checked;
txtPassword.Enabled = chkAuth.Checked;
txtUsername.Text = mpSettings.GetValue("#Client", "Username");
txtPassword.Text = mpSettings.GetValue("#Client", "Password");
txtAPIKey.Text = mpSettings.GetValue("#Client", "APIKey");
// ##################################################
// Site Settings
// ##################################################
txtMaxResults.Text = mpSettings.GetValueAsInt("#Sites", "MaxResults", 50).ToString();
chkMPTVSeries.Checked = mpSettings.GetValueAsBool("#Sites", "MPTVSeries", false);
// ##################################################
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + @"\mpNZB.xml");
// Searches
// ##################################################
foreach (XmlNode nodeItem in xmlDoc.SelectNodes("profile/section[@name='#Searches']/entry"))
{
lvSearches.Items.Add(nodeItem.Attributes["name"].InnerText).SubItems.Add(nodeItem.InnerText);
mpSettings.RemoveEntry("#Searches", nodeItem.Attributes["name"].InnerText);
}
// ##################################################
// Groups
// ##################################################
foreach (XmlNode nodeItem in xmlDoc.SelectNodes("profile/section[@name='#Groups']/entry"))
{
lvGroups.Items.Add(nodeItem.Attributes["name"].InnerText);
mpSettings.RemoveEntry("#Groups", nodeItem.Attributes["name"].InnerText);
}
// ##################################################
mpSettings.Dispose();
}
}
示例12: LoadSettings
/// <summary>
/// Loads the settings.
/// </summary>
private static void LoadSettings()
{
try
{
using (Settings xmlreader = new Settings(MPCommon.MPConfigFile))
{
ServerHost = xmlreader.GetValueAsString("MPControlPlugin", "ServerHost", "localhost");
RequireFocus = xmlreader.GetValueAsBool("MPControlPlugin", "RequireFocus", true);
MultiMappingEnabled = xmlreader.GetValueAsBool("MPControlPlugin", "MultiMappingEnabled", false);
MultiMappingButton =
(RemoteButton) xmlreader.GetValueAsInt("MPControlPlugin", "MultiMappingButton", (int) RemoteButton.Start);
EventMapperEnabled = xmlreader.GetValueAsBool("MPControlPlugin", "EventMapperEnabled", false);
MouseModeButton =
(RemoteButton) xmlreader.GetValueAsInt("MPControlPlugin", "MouseModeButton", (int) RemoteButton.Teletext);
MouseModeEnabled = xmlreader.GetValueAsBool("MPControlPlugin", "MouseModeEnabled", false);
MouseModeStep = xmlreader.GetValueAsInt("MPControlPlugin", "MouseModeStep", 10);
MouseModeAcceleration = xmlreader.GetValueAsBool("MPControlPlugin", "MouseModeAcceleration", true);
// MediaPortal settings ...
_mpBasicHome = xmlreader.GetValueAsBool("general", "startbasichome", false);
}
}
catch (Exception ex)
{
Log.Error(ex);
}
}
示例13: LoadSettings
/// <summary>
/// Load the settings
/// </summary>
protected void LoadSettings()
{
using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
{
_hiddenMode = xmlreader.GetValueAsBool("mytv", "teletextHidden", false);
_transparentMode = xmlreader.GetValueAsBool("mytv", "teletextTransparent", false);
_rememberLastValues = xmlreader.GetValueAsBool("mytv", "teletextRemember", true);
_percentageOfMaximumHeight = xmlreader.GetValueAsInt("mytv", "teletextMaxFontSize", 100);
}
}
示例14: LoadSettings
/// <summary>
/// load settings from configuration
/// </summary>
/// <returns></returns>
public bool LoadSettings(string ImportFileName)
{
string tmpConfigFileName = Config.GetFile(Config.Dir.Config, SettingsFileName);
if (ImportFileName != string.Empty)
{
tmpConfigFileName = ImportFileName;
}
using (Settings reader = new Settings(tmpConfigFileName))
{
verboseLog = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmVerboselog, false);
ShowSwitchMsg = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmShowSwitchMsg, false);
UseFallbackRule = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmUseFallbackRule, true);
String tmpFallbackViewMode = reader.GetValueAsString(ViewModeSwitcherSectionName, ParmFallbackViewMode, "Normal");
FallBackViewMode = StringToViewMode(tmpFallbackViewMode);
DisableLBGlobaly = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmDisableLBGlobaly, false);
LBMaxBlackLevel = Math.Min(Math.Max(reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmBlackLevel, 32), 4), 255);
LBMinBlackLevel = Math.Min(Math.Max(reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmMinBlackLevel, 16), 4), 255);
fboverScan = reader.GetValueAsInt(ViewModeSwitcherSectionName, FallBackOverScan, 8);
CropLeft = reader.GetValueAsInt("tv", "cropleft", 0);
CropRight = reader.GetValueAsInt("tv", "cropright", 0);
CropTop = reader.GetValueAsInt("tv", "croptop", 0);
CropBottom = reader.GetValueAsInt("tv", "cropbottom", 0);
disableForVideo = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmDisableForVideo, false);
disableLBForVideo = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmDisableLBForVideo, false);
LBSymLimitPercent = Math.Min(Math.Max(reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmSymLimitPercent, 10), 5), 90);
LBdetectInterval = Math.Min(Math.Max(reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmLBdetectInterval, 4), 2), 120);
LBMaxCropLimitPercent = Math.Min(Math.Max(reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmMaxCropLimitPercent, 12), 0), 50);
DetectWidthPercent = Math.Min(Math.Max(reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmDetectWidthPercent, 40), 10), 90);
DetectHeightPercent = Math.Min(Math.Max(reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmDetectHeightPercent, 40), 10), 90);
if (verboseLog)
{
Log.Debug("ViewModeSwitcher: Global Rule, ShowSwitchMsg: " + ShowSwitchMsg);
Log.Debug("ViewModeSwitcher: Global Rule, UseFallbackRule: " + UseFallbackRule);
Log.Debug("ViewModeSwitcher: Global Rule, FallBackViewMode: " + FallBackViewMode);
Log.Debug("ViewModeSwitcher: Global Rule, FallbackOverscan: " + fboverScan);
Log.Debug("ViewModeSwitcher: Global Rule, DisableBBDetect: " + DisableLBGlobaly);
Log.Debug("ViewModeSwitcher: Global Rule, BBMaxBlackLevel: " + LBMaxBlackLevel);
Log.Debug("ViewModeSwitcher: Global Rule, BBMinBlackLevel: " + LBMinBlackLevel);
Log.Debug("ViewModeSwitcher: Global Rule, BBSymLimitPercent: " + LBSymLimitPercent);
Log.Debug("ViewModeSwitcher: Global Rule, BBdetectInterval: " + LBdetectInterval);
Log.Debug("ViewModeSwitcher: Global Rule, BBMaxCropLimPercent: " + LBMaxCropLimitPercent);
Log.Debug("ViewModeSwitcher: Global Rule, BBDetectWidthPercent: " + DetectWidthPercent);
Log.Debug("ViewModeSwitcher: Global Rule, BBDetectHeightPercent: " + DetectHeightPercent);
Log.Debug("ViewModeSwitcher: Global Rule, disableForVideo: " + disableForVideo);
Log.Debug("ViewModeSwitcher: Global Rule, disableBBForVideo: " + disableLBForVideo);
}
bool tmpReturn = false;
ViewModeRules.Clear();
int tmpRuleCount = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmRuleCount, 0);
if (tmpRuleCount <= 0)
{
Rule tmpRule = new Rule();
tmpRule.Enabled = true;
tmpRule.Name = "4:3 SD";
tmpRule.ARFrom = 1.2;
tmpRule.ARTo = 1.46;
tmpRule.MinWidth = 200;
tmpRule.MaxWidth = 799;
tmpRule.MinHeight = 200;
tmpRule.MaxHeight = 599;
tmpRule.ViewMode = Geometry.Type.Zoom14to9;
tmpRule.OverScan = 8;
tmpRule.EnableLBDetection = true;
tmpRule.AutoCrop = true;
tmpRule.MaxCrop = true;
ViewModeRules.Add(tmpRule);
tmpRule = new Rule();
tmpRule.Enabled = true;
tmpRule.Name = "4:3 HD";
tmpRule.ARFrom = 1.2;
tmpRule.ARTo = 1.46;
tmpRule.MinWidth = 800;
tmpRule.MaxWidth = 2000;
tmpRule.MinHeight = 600;
tmpRule.MaxHeight = 2000;
tmpRule.ViewMode = Geometry.Type.Zoom14to9;
tmpRule.OverScan = 16;
tmpRule.EnableLBDetection = false;
tmpRule.AutoCrop = false;
tmpRule.MaxCrop = true;
ViewModeRules.Add(tmpRule);
tmpRule = new Rule();
tmpRule.Enabled = true;
tmpRule.Name = "16:9 SD";
tmpRule.ARFrom = 1.7;
tmpRule.ARTo = 1.9;
tmpRule.MinWidth = 200;
tmpRule.MaxWidth = 799;
tmpRule.MinHeight = 200;
tmpRule.MaxHeight = 599;
tmpRule.ViewMode = Geometry.Type.Normal;
//.........这里部分代码省略.........
示例15: LoadSettings
/// <summary>
/// load settings from configuration
/// </summary>
/// <returns></returns>
public bool LoadSettings(string ImportFileName)
{
string tmpConfigFileName = Config.GetFile(Config.Dir.Config, "ViewModeSwitcher.xml");
if (ImportFileName != string.Empty)
{
tmpConfigFileName = ImportFileName;
}
using (Settings reader = new Settings(tmpConfigFileName))
{
verboseLog = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmVerboselog, false);
ShowSwitchMsg = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmShowSwitchMsg, false);
UseFallbackRule = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmUseFallbackRule, true);
String tmpFallbackViewMode = reader.GetValueAsString(ViewModeSwitcherSectionName, ParmFallbackViewMode, "Normal");
FallBackViewMode = StringToViewMode(tmpFallbackViewMode);
DisableLBGlobaly = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmDisableLBGlobaly, false);
LBBlackLevel = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmBlackLevel, 40);
fboverScan = reader.GetValueAsInt(ViewModeSwitcherSectionName, FallBackOverScan, 0);
CropLeft = reader.GetValueAsInt("tv", "cropleft", 0);
CropRight = reader.GetValueAsInt("tv", "cropright", 0);
CropTop = reader.GetValueAsInt("tv", "croptop", 0);
CropBottom = reader.GetValueAsInt("tv", "cropbottom", 0);
bool tmpReturn = false;
ViewModeRules.Clear();
int tmpRuleCount = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmRuleCount, 0);
if (tmpRuleCount <= 0)
{
Rule tmpRule = new Rule();
tmpRule.Enabled = true;
tmpRule.Name = "4:3";
tmpRule.ARFrom = 1.1f;
tmpRule.ARTo = 1.334f;
tmpRule.MinWidth = 200;
tmpRule.MaxWidth = 2000;
tmpRule.MinHeight = 200;
tmpRule.MaxHeight = 2000;
tmpRule.ChangeAR = true;
tmpRule.ViewMode = Geometry.Type.NonLinearStretch;
tmpRule.ChangeOs = true;
tmpRule.OverScan = 8;
tmpRule.EnableLBDetection = true;
ViewModeRules.Add(tmpRule);
tmpRule = new Rule();
tmpRule.Enabled = true;
tmpRule.Name = "16:9";
tmpRule.ARFrom = 1.77f;
tmpRule.ARTo = 1.78f;
tmpRule.MinWidth = 200;
tmpRule.MaxWidth = 2000;
tmpRule.MinHeight = 200;
tmpRule.MaxHeight = 2000;
tmpRule.ChangeAR = true;
tmpRule.ViewMode = Geometry.Type.Normal;
tmpRule.ChangeOs = true;
tmpRule.OverScan = 8;
tmpRule.EnableLBDetection = true;
ViewModeRules.Add(tmpRule);
return true;
}
for (int i = 1; i <= tmpRuleCount; i++)
{
Rule tmpRule = new Rule();
tmpRule.Enabled = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i + "Enabled", false);
if (tmpRule.Enabled)
{
tmpReturn = true;
}
tmpRule.Name = reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i + "Name", "noname");
tmpRule.ARFrom =
(float)
Convert.ToDouble(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i + "ARFrom", "0"));
tmpRule.ARTo =
(float)
Convert.ToDouble(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i + "ARTo", "0"));
tmpRule.MinWidth =
Convert.ToInt16(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i + "MinWidth", "0"));
tmpRule.MaxWidth =
Convert.ToInt16(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i + "MaxWidth", "0"));
tmpRule.MinHeight =
Convert.ToInt16(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i + "MinHeight", "0"));
tmpRule.MaxHeight =
Convert.ToInt16(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i + "MaxHeight", "0"));
tmpRule.ChangeAR = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i + "ChangeAR", true);
String tmpViewMode = reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i + "ViewMode",
"Normal");
tmpRule.ViewMode = StringToViewMode(tmpViewMode);
tmpRule.ChangeOs = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i + "ChangeOS", true);
tmpRule.OverScan =
Convert.ToInt16(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i + "Overscan", "0"));
tmpRule.EnableLBDetection = reader.GetValueAsBool(ViewModeSwitcherSectionName,
ParmRulePrefix + i + "EnableLBDetection", false);
tmpRule.VerticalOffSetZoom =
Convert.ToInt16(reader.GetValueAsString(ViewModeSwitcherSectionName,
//.........这里部分代码省略.........