本文整理汇总了C#中MPSettings.GetValueAsString方法的典型用法代码示例。如果您正苦于以下问题:C# MPSettings.GetValueAsString方法的具体用法?C# MPSettings.GetValueAsString怎么用?C# MPSettings.GetValueAsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MPSettings
的用法示例。
在下文中一共展示了MPSettings.GetValueAsString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadSettings
public override void LoadSettings()
{
if (_serialPort != null && _serialPort.IsOpen)
_serialPort.Close();
using (Settings reader = new MPSettings())
{
DeviceModelName = reader.GetValueAsString("Auto3DPlugin", "EpsonModel", "Default");
PortName = reader.GetValueAsString("Auto3DPlugin", "EpsonPort", "None");
}
if (_serialPort != null)
{
_serialPort.PortName = PortName;
try
{
if (_serialPort.PortName != "None")
_serialPort.Open();
}
catch (Exception ex)
{
Auto3DHelpers.ShowAuto3DMessage("Opening serial port failed: " + ex.Message, false, 0);
Log.Info("Auto3D: " + ex.Message);
}
}
}
示例2: MatchConfiguredFPS
internal static double MatchConfiguredFPS(double probedFps)
{
if (fpsList == null)
{
fpsList = new List<double>();
NumberFormatInfo provider = new NumberFormatInfo() { NumberDecimalSeparator = "." };
Settings xmlreader = new MPSettings();
for (int i = 1; i < 100; i++)
{
string name = xmlreader.GetValueAsString("general", "refreshrate0" + Convert.ToString(i) + "_name", "");
if (string.IsNullOrEmpty(name)) continue;
string fps = xmlreader.GetValueAsString("general", name + "_fps", "");
string[] fpsArray = fps.Split(';');
foreach (string fpsItem in fpsArray)
{
double fpsAsDouble = -1;
double.TryParse(fpsItem, NumberStyles.AllowDecimalPoint, provider, out fpsAsDouble);
if (fpsAsDouble > -1) fpsList.Add(fpsAsDouble);
}
}
fpsList = fpsList.Distinct().ToList();
fpsList.Sort();
}
if (fpsList != null && fpsList.Count > 0)
{
return fpsList.FirstOrDefault(f => Math.Abs(f - probedFps) < 0.24f);
}
return default(double);
}
示例3: LoadSettings
public override void LoadSettings()
{
if (_serialPort != null && _serialPort.IsOpen)
_serialPort.Close();
using (Settings reader = new MPSettings())
{
DeviceModelName = reader.GetValueAsString("Auto3DPlugin", "OptomaModel", "Default");
PortName = reader.GetValueAsString("Auto3DPlugin", "OptomaPort", "None");
}
if (_serialPort != null)
{
_serialPort.PortName = PortName;
try
{
if (_serialPort.PortName != "None")
_serialPort.Open();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Auto3D");
Log.Info("Auto3D: " + ex.Message);
}
}
}
示例4: LoadSettings
public override void LoadSettings()
{
using (Settings xmlreader = new MPSettings())
{
pixelRatioCheckBox.Checked = xmlreader.GetValueAsBool("dvdplayer", "pixelratiocorrection", false);
aspectRatioComboBox.Text = xmlreader.GetValueAsString("dvdplayer", "armode", "Follow stream");
displayModeComboBox.Text = xmlreader.GetValueAsString("dvdplayer", "displaymode", "Default");
//
// Load all available aspect ratio
//
defaultZoomModeComboBox.Items.Clear();
foreach (Geometry.Type item in Enum.GetValues(typeof (Geometry.Type)))
{
defaultZoomModeComboBox.Items.Add(Util.Utils.GetAspectRatio(item));
}
//
// Set default aspect ratio
//
string defaultAspectRatio = xmlreader.GetValueAsString("dvdplayer", "defaultar",
defaultZoomModeComboBox.Items[0].ToString());
foreach (Geometry.Type item in Enum.GetValues(typeof (Geometry.Type)))
{
string currentAspectRatio = Util.Utils.GetAspectRatio(item);
if (defaultAspectRatio == currentAspectRatio)
{
defaultZoomModeComboBox.SelectedItem = currentAspectRatio;
break;
}
}
}
}
示例5: LoadSettings
/// <summary>
///
/// </summary>
public override void LoadSettings()
{
using (Settings xmlreader = new MPSettings())
{
chbEnabled.Checked = xmlreader.GetValueAsBool("filemenu", "enabled", true);
textPinCodeBox.Text = Util.Utils.DecryptPassword(xmlreader.GetValueAsString("filemenu", "pincode", ""));
textTrashcanFolder.Text = xmlreader.GetValueAsString("filemenu", "trashcan", "");
}
}
示例6: LoadSettings
private void LoadSettings()
{
using (Settings xmlreader = new MPSettings())
{
_serveradress = xmlreader.GetValueAsString("MPDomoticz", "ServerAdress", "localhost");
_serverport = xmlreader.GetValueAsString("MPDomoticz", "ServerPort", "8080");
_username = xmlreader.GetValueAsString("MPDomoticz", "Username", "");
_password = xmlreader.GetValueAsString("MPDomoticz", "Password", "");
RefreshInterval = xmlreader.GetValueAsInt("MPDomoticz", "RefreshInterval", 30);
}
}
示例7: LoadSettings
private void LoadSettings()
{
using (Settings xmlreader = new MPSettings())
{
_serverHostName = xmlreader.GetValueAsString("tvservice", "hostname", "");
_preferredLanguages = xmlreader.GetValueAsString("tvservice", "preferredlanguages", "");
_preferAC3 = xmlreader.GetValueAsBool("tvservice", "preferac3", false);
_rebuildGraphOnNewAudioSpecs = xmlreader.GetValueAsBool("tvservice", "rebuildgraphOnNewAudioSpecs", true);
_rebuildGraphOnNewVideoSpecs = xmlreader.GetValueAsBool("tvservice", "rebuildgraphOnNewVideoSpecs", true);
_avoidSeeking = xmlreader.GetValueAsBool("tvservice", "avoidSeeking", false);
}
}
示例8: Init
public bool Init()
{
Log.Info("Initialising WinLirc...");
//load settings
using (Settings xmlreader = new MPSettings())
{
m_bEnabled = xmlreader.GetValueAsString("WINLIRC", "enabled", "false") == "true";
if (m_bEnabled == false)
{
return true;
}
m_pathtowinlirc = xmlreader.GetValueAsString("WINLIRC", "winlircpath", "");
string delay = xmlreader.GetValueAsString("WINLIRC", "delay", "300");
try
{
m_IRdelay = Int32.Parse(delay);
if (m_IRdelay < 0 || m_IRdelay >= 1000)
{
m_IRdelay = 300;
}
}
catch (Exception)
{
m_IRdelay = 300;
}
//m_bMultipleRemotes = xmlreader.GetValueAsString("WINLIRC", "use_multiple_remotes", "true") == "true";
//m_remote = xmlreader.GetValueAsString("WINLIRC", "remote", "") ;
//m_repeat = xmlreader.GetValueAsString("WINLIRC", "repeat", "0");
//m_bNeedsEnter = xmlreader.GetValueAsString("WINLIRC", "needs_enter", "false") == "true";
}
//find winlirc
m_windowName = "WinLIRC";
m_hwnd = Win32API.FindWindow(null, m_windowName);
//check we found it - if not, start it!
if (m_hwnd.ToInt32() <= 0) // try to find it and start it since it's not found
{
Log.Info("WinLirc window not found, starting WinLirc");
IntPtr mpHwnd = Win32API.GetActiveWindow(); //Get MP
StartWinLirc(m_pathtowinlirc); //Start Winlirc
Win32API.ShowWindow(mpHwnd, Win32API.ShowWindowFlags.Restore); //restore MP
Win32API.SetForegroundWindow(mpHwnd); //restore MP
}
if (m_hwnd.ToInt32() > 0)
{
Log.Info("Winlirc OK");
return true;
}
Log.Info("Winlirc process not found");
return false;
}
示例9: LoadSettings
/// <summary>
/// Loads the movie player settings
/// </summary>
public override void LoadSettings()
{
if (_init == false)
{
return;
}
using (Settings xmlreader = new MPSettings())
{
fileNameTextBox.Text = xmlreader.GetValueAsString("movieplayer", "path", "");
parametersTextBox.Text = xmlreader.GetValueAsString("movieplayer", "arguments", "");
externalPlayerCheckBox.Checked = xmlreader.GetValueAsBool("movieplayer", "internal", true);
externalPlayerCheckBox.Checked = !externalPlayerCheckBox.Checked;
wmvCheckBox.Checked = xmlreader.GetValueAsBool("movieplayer", "wmvaudio", false);
}
}
示例10: LoadSettings
/// <summary>
///
/// </summary>
public override void LoadSettings()
{
using (Settings xmlreader = new MPSettings())
{
fileNameTextBox.Text = xmlreader.GetValueAsString("dvdplayer", "path", @"");
parametersTextBox.Text = xmlreader.GetValueAsString("dvdplayer", "arguments", "");
useMediaInfo.Checked = xmlreader.GetValueAsBool("dvdplayer", "mediainfoused", false);
useExternalPlayerForDVD.Checked = xmlreader.GetValueAsBool("dvdplayer", "usefordvd", true);
//
// Fake a check changed to force a CheckChanged event
//
useExternalPlayerForDVD.Checked = xmlreader.GetValueAsBool("dvdplayer", "internal", true);
useExternalPlayerForDVD.Checked = !useExternalPlayerForDVD.Checked;
}
}
示例11: LoadSettings
public override void LoadSettings()
{
using (Settings xmlreader = new MPSettings())
{
inputCheckBox.Checked = xmlreader.GetValueAsBool("WINLIRC", "enabled", false);
pathToWinlircTextBox.Text = xmlreader.GetValueAsString("WINLIRC", "winlircpath", "");
IRDelayTextBox.Text = xmlreader.GetValueAsString("WINLIRC", "delay", "300");
//useMultipleCheckBox.Checked = xmlreader.GetValueAsString("WINLIRC", "use_multiple_remotes", "true") == "true";
//remoteNameTextBox.Text = xmlreader.GetValueAsString("WINLIRC", "remote", "") ;
//repeatValTextBox.Text = xmlreader.GetValueAsString("WINLIRC", "repeat", "0");
//enterCheckBox.Checked = xmlreader.GetValueAsString("WINLIRC", "needs_enter", "false") == "true";
}
UpdateForm();
LoadInfo();
}
示例12: OnPageLoad
protected override void OnPageLoad()
{
base.OnPageLoad();
//Load settings
Log.Info("GUISkipSteps: {0}", "Load settings");
string regValue = string.Empty;
using (Settings xmlreader = new MPSettings())
{
try
{
regValue = xmlreader.GetValueAsString("movieplayer", "skipsteps", DEFAULT_SETTING);
if (regValue == string.Empty) // config after wizard run 1st
{
regValue = DEFAULT_SETTING;
Log.Info("GeneralSkipSteps - creating new Skip-Settings {0}", "");
}
else if (OldStyle(regValue))
{
regValue = ConvertToNewStyle(regValue);
}
labelCurrent.Label = regValue;
}
catch (Exception ex)
{
Log.Info("GeneralSkipSteps - Exception while loading Skip-Settings: {0}", ex.ToString());
}
}
SetCheckMarksBasedOnString(regValue);
GUIControl.FocusControl(GetID, checkMarkButtonStep1.GetID);
}
示例13: LoadSettings
public override void LoadSettings()
{
using (Settings xmlreader = new MPSettings())
{
loglevel = xmlreader.GetValueAsString("general", "loglevel", "3"); // set loglevel to 2:info 3:debug
cbDebug.SelectedIndex = Convert.ToInt16(loglevel);
string prio = xmlreader.GetValueAsString("general", "ThreadPriority", "Normal");
// Set the selected index, otherwise the SelectedItem in SaveSettings will be null, if the box isn't checked
mpThreadPriority.SelectedIndex = mpThreadPriority.Items.IndexOf(prio);
checkBoxEnableWatchdog.Checked = xmlreader.GetValueAsBool("general", "watchdogEnabled", false);
checkBoxAutoRestart.Checked = xmlreader.GetValueAsBool("general", "restartOnError", true);
numericUpDownDelay.Value = xmlreader.GetValueAsInt("general", "restart delay", 10);
}
}
示例14: LoadSettings
public override void LoadSettings()
{
using (Settings xmlreader = new MPSettings())
{
// Get hostname entry
_settingsHostname = xmlreader.GetValueAsString("tvservice", "hostname", string.Empty);
if (string.IsNullOrEmpty(_settingsHostname))
{
// Set hostname to local host
mpTextBoxHostname.Text = Dns.GetHostName();
_verifiedHostname = string.Empty;
Log.Debug("LoadSettings: set hostname to local host: \"{0}\"", mpTextBoxHostname.Text);
}
else
{
// Take verified hostname from MediaPortal.xml
mpTextBoxHostname.Text = _settingsHostname;
_verifiedHostname = mpTextBoxHostname.Text;
mpTextBoxHostname.BackColor = Color.YellowGreen;
Log.Debug("LoadSettings: take hostname from settings: \"{0}\"", mpTextBoxHostname.Text);
}
mpCheckBoxIsWakeOnLanEnabled.Checked = xmlreader.GetValueAsBool("tvservice", "isWakeOnLanEnabled", false);
mpNumericTextBoxWOLTimeOut.Text = xmlreader.GetValueAsString("tvservice", "WOLTimeOut", "10");
mpCheckBoxIsAutoMacAddressEnabled.Checked = xmlreader.GetValueAsBool("tvservice", "isAutoMacAddressEnabled",
true);
mpTextBoxMacAddress.Text = xmlreader.GetValueAsString("tvservice", "macAddress", "00:00:00:00:00:00");
mpCheckBoxIsWakeOnLanEnabled_CheckedChanged(null, null);
}
}
示例15: LoadSettings
private void LoadSettings()
{
using (Settings xmlreader = new MPSettings())
{
_hostName = xmlreader.GetValueAsString("tvservice", "hostname", "");
}
}