本文整理汇总了C#中Settings.GetValueAsInt方法的典型用法代码示例。如果您正苦于以下问题:C# Settings.GetValueAsInt方法的具体用法?C# Settings.GetValueAsInt怎么用?C# Settings.GetValueAsInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings.GetValueAsInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Geometry
/// <summary>
/// Empty constructor
/// </summary>
public Geometry()
{
using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
{
nlsZoomY = (float)xmlreader.GetValueAsInt("nls", "zoom", 115) / 100.0f;
nlsVertPos = (float)xmlreader.GetValueAsInt("nls", "vertpos", 30) / 100.0f;
}
}
示例2: LoadSettings
public override void LoadSettings()
{
using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
{
numNlsCenterZone.Value = Convert.ToInt16(xmlreader.GetValueAsInt("nls", "center zone", 50));
numNlsZoom.Value = Convert.ToInt16(xmlreader.GetValueAsInt("nls", "zoom", 115));
numNlsStretchX.Value = Convert.ToInt16(xmlreader.GetValueAsInt("nls", "stretchx", 103));
numNlsVertPos.Value = Convert.ToInt16(xmlreader.GetValueAsInt("nls", "vertpos", 30));
}
}
示例3: 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;
}
示例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: 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);
}
示例6: OnClicked
protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
{
// we don't want the user to start another search while one is already active
if (_workerCompleted == false)
{
return;
}
// Here we want to open the OSD Keyboard to enter the searchstring
if (control == buttonSearch)
{
// If the search Button was clicked we need to bring up the search keyboard.
VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)Window.WINDOW_VIRTUAL_KEYBOARD);
if (null == keyboard)
{
return;
}
string searchterm = string.Empty;
//keyboard.IsSearchKeyboard = true;
keyboard.Reset();
keyboard.Text = "";
keyboard.DoModal(GetID); // show it...
Log.Info("Wikipedia: OSD keyboard loaded!");
// If input is finished, the string is saved to the searchterm var.
if (keyboard.IsConfirmed)
{
searchterm = keyboard.Text;
// If there was a string entered try getting the article.
if (searchterm != "")
{
Log.Info("Wikipedia: Searchterm gotten from OSD keyboard: {0}", searchterm);
GetAndDisplayArticle(searchterm);
}
// Else display an error dialog.
else
{
GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
dlg.SetLine(1, GUILocalizeStrings.Get(2500)); // No searchterm entered!
dlg.SetLine(2, string.Empty);
dlg.SetLine(3, GUILocalizeStrings.Get(2501)); // Please enter a valid searchterm!
dlg.DoModal(GUIWindowManager.ActiveWindow);
}
}
}
// This is the control to select the local Wikipedia site.
if (control == buttonLocal)
{
// Create a new selection dialog.
GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
if (pDlgOK != null)
{
pDlgOK.Reset();
pDlgOK.SetHeading(GUILocalizeStrings.Get(2502)); //Select your local Wikipedia:
// Add all the local sites we want to be displayed starting with int 0.
Settings langreader = new Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
String allsites = langreader.GetValueAsString("Allsites", "sitenames", "");
Log.Info("Wikipedia: available sites: " + allsites);
String[] siteArray = allsites.Split(',');
for (int i = 0; i < siteArray.Length; i++)
{
int stringno = langreader.GetValueAsInt(siteArray[i], "string", 2006);
pDlgOK.Add(GUILocalizeStrings.Get(stringno)); //English, German, French ...
}
pDlgOK.DoModal(GetID);
if (pDlgOK.SelectedLabel >= 0)
{
SelectLocalWikipedia(pDlgOK.SelectedLabel, siteArray);
}
}
}
// The Button holding the Links to other articles
if (control == buttonLinks)
{
if (linkArray.Count > 0)
{
// Create a new selection dialog.
GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
if (pDlgOK != null)
{
pDlgOK.Reset();
pDlgOK.SetHeading(GUILocalizeStrings.Get(2505)); //Links to other articles:
// Add all the links from the linkarray.
foreach (string link in linkArray)
{
pDlgOK.Add(link);
}
pDlgOK.DoModal(GetID);
if (pDlgOK.SelectedLabel >= 0)
{
Log.Info("Wikipedia: new search from the links array: {0}", pDlgOK.SelectedLabelText);
GetAndDisplayArticle(pDlgOK.SelectedLabelText);
}
}
//.........这里部分代码省略.........
示例7: LoadSettings
public void LoadSettings(Settings xmlreader)
{
Log.Info("ChannelNavigator::LoadSettings()");
string currentchannelName = xmlreader.GetValueAsString("mytv", "channel", String.Empty);
m_zapdelay = 1000 * xmlreader.GetValueAsInt("movieplayer", "zapdelay", 2);
string groupname = xmlreader.GetValueAsString("mytv", "group", TvConstants.TvGroupNames.AllChannels);
m_currentgroup = GetGroupIndex(groupname);
if (m_currentgroup < 0 || m_currentgroup >= m_groups.Count) // Group no longer exists?
{
m_currentgroup = 0;
}
m_currentChannel = GetChannel(currentchannelName);
if (m_currentChannel == null)
{
if (m_currentgroup < m_groups.Count)
{
ChannelGroup group = (ChannelGroup)m_groups[m_currentgroup];
if (group.ReferringGroupMap().Count > 0)
{
GroupMap gm = (GroupMap)group.ReferringGroupMap()[0];
m_currentChannel = gm.ReferencedChannel();
}
}
}
//check if the channel does indeed belong to the group read from the XML setup file ?
bool foundMatchingGroupName = false;
if (m_currentChannel != null)
{
foreach (GroupMap groupMap in m_currentChannel.ReferringGroupMap())
{
foundMatchingGroupName = DoesGroupNameContainGroupName(groupMap, groupname);
if (foundMatchingGroupName)
{
break;
}
}
}
//if we still havent found the right group, then iterate through the selected group and find the channelname.
if (!foundMatchingGroupName && m_currentChannel != null && m_groups != null)
{
foreach (GroupMap groupMap in ((ChannelGroup)m_groups[m_currentgroup]).ReferringGroupMap())
{
if (groupMap.ReferencedChannel().DisplayName == currentchannelName)
{
foundMatchingGroupName = true;
m_currentChannel = GetChannel(groupMap.ReferencedChannel().IdChannel);
break;
}
}
}
// if the groupname does not match any of the groups assigned to the channel, then find the last group avail. (avoiding the all "channels group") for that channel and set is as the new currentgroup
if (!foundMatchingGroupName && m_currentChannel != null && m_currentChannel.ReferringGroupMap().Count > 0)
{
GroupMap groupMap =
(GroupMap) m_currentChannel.ReferringGroupMap()[m_currentChannel.ReferringGroupMap().Count - 1];
ChannelGroup group = groupMap.ReferencedChannelGroup();
if (group != null)
{
m_currentgroup = GetGroupIndex(group.GroupName);
if (m_currentgroup < 0 || m_currentgroup >= m_groups.Count) // Group no longer exists?
{
m_currentgroup = 0;
}
}
else
{
m_currentgroup = 0;
}
}
if (m_currentChannel != null)
{
m_currentChannel.CurrentGroup = CurrentGroup;
}
}
示例8: Load
/// <summary>
/// Load calibration values for current resolution
/// </summary>
public static void Load()
{
OverScanLeft = 0;
OverScanTop = 0;
PixelRatio = 1.0f;
OSDOffset = 0;
Subtitles = Height - 50;
OverScanWidth = Width;
OverScanHeight = Height;
ZoomHorizontal = 1.0f;
ZoomVertical = 1.0f;
string strFileName = Config.GetFile(Config.Dir.Config, String.Format("ScreenCalibration{0}x{1}", Width, Height));
strFileName += Fullscreen ? ".fs.xml" : ".xml";
if (!File.Exists(strFileName))
{
Log.Warn("GraphicContext: NO screen calibration file found for resolution {0}x{1}!", Width, Height);
}
else
{
Log.Debug("GraphicContext: Loading settings from {0}", strFileName);
}
using (var xmlReader = new Settings(strFileName))
{
try
{
OffsetX = xmlReader.GetValueAsInt("screen", "offsetx", 0);
OffsetY = xmlReader.GetValueAsInt("screen", "offsety", 0);
OSDOffset = xmlReader.GetValueAsInt("screen", "offsetosd", 0);
OverScanLeft = xmlReader.GetValueAsInt("screen", "overscanleft", 0);
OverScanTop = xmlReader.GetValueAsInt("screen", "overscantop", 0);
OverScanWidth = xmlReader.GetValueAsInt("screen", "overscanwidth", Width);
OverScanHeight = xmlReader.GetValueAsInt("screen", "overscanheight", Height);
_subtitles = xmlReader.GetValueAsInt("screen", "subtitles", Height - 50);
int intPixelRation = xmlReader.GetValueAsInt("screen", "pixelratio", 10000);
PixelRatio = intPixelRation;
PixelRatio /= 10000f;
int intZoomHorizontal = xmlReader.GetValueAsInt("screen", "zoomhorizontal", 10000);
_zoomHorizontal = intZoomHorizontal / 10000f;
int intZoomVertical = xmlReader.GetValueAsInt("screen", "zoomvertical", 10000);
_zoomVertical = intZoomVertical / 10000f;
}
catch (Exception ex)
{
Log.Error("GraphicContext: Error loading settings from {0} - {1}", strFileName, ex.Message);
}
}
using (Settings xmlReader = new MPSettings())
{
_maxFPS = xmlReader.GetValueAsInt("screen", "GuiRenderFps", 60);
SyncFrameTime();
_scrollSpeedVertical = xmlReader.GetValueAsInt("gui", "ScrollSpeedDown", 4);
_scrollSpeedHorizontal = xmlReader.GetValueAsInt("gui", "ScrollSpeedRight", 3);
Animations = xmlReader.GetValueAsBool("general", "animations", true);
_turnOffMonitor = xmlReader.GetValueAsBool("general", "turnoffmonitor", false);
}
}
示例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: InitLogger
private void InitLogger()
{
var loggingConfiguration = LogManager.Configuration ?? new LoggingConfiguration();
try
{
var fileInfo = new FileInfo(Config.GetFile((Config.Dir)1, LogFileName));
if (fileInfo.Exists)
{
if (File.Exists(Config.GetFile((Config.Dir)1, OldLogFileName)))
File.Delete(Config.GetFile((Config.Dir)1, OldLogFileName));
fileInfo.CopyTo(Config.GetFile((Config.Dir)1, OldLogFileName));
fileInfo.Delete();
}
}
catch { }
var fileTarget = new FileTarget
{
FileName = Config.GetFile((Config.Dir) 1, LogFileName),
Encoding = "utf-8",
Layout =
"${date:format=dd-MMM-yyyy HH\\:mm\\:ss} ${level:fixedLength=true:padding=5} [${logger:fixedLength=true:padding=20:shortName=true}]: ${message} ${exception:format=tostring}"
};
loggingConfiguration.AddTarget("file", fileTarget);
var settings = new Settings(Config.GetFile((Config.Dir)10, "MediaPortal.xml"));
LogLevel minLevel;
switch ((int)(Level)settings.GetValueAsInt("general", "loglevel", 0))
{
case 0:
minLevel = LogLevel.Error;
break;
case 1:
minLevel = LogLevel.Warn;
break;
case 2:
minLevel = LogLevel.Info;
break;
default:
minLevel = LogLevel.Debug;
break;
}
var loggingRule = new LoggingRule("*", minLevel, fileTarget);
loggingConfiguration.LoggingRules.Add(loggingRule);
LogManager.Configuration = loggingConfiguration;
}
示例11: 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); }
}
示例12: 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();
}
}
示例13: 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);
}
}
示例14: 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);
}
}
示例15: 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;
//.........这里部分代码省略.........