本文整理汇总了C#中MPSettings.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# MPSettings.GetValue方法的具体用法?C# MPSettings.GetValue怎么用?C# MPSettings.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MPSettings
的用法示例。
在下文中一共展示了MPSettings.GetValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetValue
protected object GetValue(string name)
{
using (Settings xmlreader = new MPSettings())
{
return xmlreader.GetValue(CONFIG_SECTION, _prefix + "_" + name);
}
}
示例2: LoadSettings
/// <summary>
/// Loads the standby configuration
/// </summary>
private void LoadSettings()
{
bool changed = false;
bool boolSetting;
int intSetting;
string stringSetting;
PowerSetting powerSetting;
Log.Debug("PS: LoadSettings()");
// Load initial settings only once
if (_settings == null)
{
using (Settings reader = new MPSettings())
{
// Check if update of old PS settings is necessary
if (reader.GetValue("psclientplugin", "ExpertMode") == "")
{
// Initialise list of old and new settings names to update
List<String[]> settingNames = new List<String[]>();
settingNames.Add(new String[] { "homeonly", "HomeOnly" });
settingNames.Add(new String[] { "idletimeout", "IdleTimeout" });
settingNames.Add(new String[] { "shutdownenabled", "ShutdownEnabled" });
settingNames.Add(new String[] { "shutdownmode", "ShutdownMode" });
// Update settings names
foreach (String[] settingName in settingNames)
{
String settingValue = reader.GetValue("psclientplugin", settingName[0]);
if (settingValue != "")
{
reader.RemoveEntry("psclientplugin", settingName[0]);
reader.SetValue("psclientplugin", settingName[1], settingValue);
}
}
}
_settings = new PowerSettings();
changed = true;
// Set constant values (needed for backward compatibility)
_settings.ForceShutdown = false;
_settings.ExtensiveLogging = false;
_settings.PreNoShutdownTime = 300;
_settings.CheckInterval = 15;
// Check if we only should suspend in MP's home window
boolSetting = reader.GetValueAsBool("psclientplugin", "HomeOnly", false);
powerSetting = _settings.GetSetting("HomeOnly");
powerSetting.Set<bool>(boolSetting);
Log.Debug("PS: Only allow standby when on home window: {0}", boolSetting);
// Get external command
stringSetting = reader.GetValueAsString("psclientplugin", "Command", String.Empty);
powerSetting = _settings.GetSetting("Command");
powerSetting.Set<string>(stringSetting);
Log.Debug("PS: Run command on power state change: {0}", stringSetting);
// Check if we should unmute the master volume
boolSetting = reader.GetValueAsBool("psclientplugin", "UnmuteMasterVolume", true);
powerSetting = _settings.GetSetting("UnmuteMasterVolume");
powerSetting.Set<bool>(boolSetting);
Log.Debug("PS: Unmute master volume: {0}", boolSetting);
// Detect single-seat
string tvPluginDll = Config.GetSubFolder(Config.Dir.Plugins, "windows") + @"\" + "TvPlugin.dll";
if (File.Exists(tvPluginDll))
{
string hostName = reader.GetValueAsString("tvservice", "hostname", String.Empty);
if (hostName != String.Empty && PowerManager.IsLocal(hostName))
{
_singleSeat = true;
Log.Info("PS: Detected single-seat setup - TV-Server on local system");
}
else if (hostName == String.Empty)
{
_singleSeat = false;
Log.Info("PS: Detected standalone client setup - no TV-Server configured");
}
else
{
_singleSeat = false;
Log.Info("PS: Detected remote client setup - TV-Server on \"{0}\"", hostName);
RemotePowerControl.HostName = hostName;
Log.Debug("PS: Set RemotePowerControl.HostName: {0}", hostName);
}
}
else
{
_singleSeat = false;
Log.Info("PS: Detected standalone client setup - no TV-Plugin installed");
}
// Standalone client has local standby / wakeup settings
if (!_singleSeat)
//.........这里部分代码省略.........
示例3: Load
void Load()
{
OnlineVideos.OnlineVideoSettings ovsconf = OnlineVideos.OnlineVideoSettings.Instance;
ovsconf.UserStore = new UserStore();
ovsconf.FavDB = FavoritesDatabase.Instance;
ovsconf.Logger = Log.Instance;
ovsconf.ThumbsDir = Config.GetFolder(Config.Dir.Thumbs) + @"\OnlineVideos\";
ovsconf.ConfigDir = Config.GetFolder(Config.Dir.Config);
ovsconf.DllsDir = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "OnlineVideos\\");
// When run from MPEI we get an invalid plugin directory, we'll try to rectify that here
try
{
var hasFiles = true;
if (Directory.Exists(ovsconf.DllsDir))
{
var files = Directory.GetFiles(ovsconf.DllsDir, "OnlineVideos.Sites.*.dll");
if (files == null || files.Count() == 0)
hasFiles = false;
}
else
hasFiles = false;
if (!hasFiles)
ovsconf.DllsDir = Path.Combine(MediaPortal.Configuration.Config.GetDirectoryInfo(MediaPortal.Configuration.Config.Dir.Plugins).FullName, "Windows\\OnlineVideos");
}
catch (Exception ex)
{
Log.Instance.Error(ex);
}
ovsconf.ThumbsResizeOptions = new OnlineVideos.Downloading.ImageDownloader.ResizeOptions()
{
MaxSize = (int)Thumbs.ThumbLargeResolution,
Compositing = Thumbs.Compositing,
Interpolation = Thumbs.Interpolation,
Smoothing = Thumbs.Smoothing
};
try
{
ovsconf.Locale = CultureInfo.CreateSpecificCulture(GUILocalizeStrings.GetCultureName(GUILocalizeStrings.CurrentLanguage()));
}
catch (Exception ex)
{
Log.Instance.Error(ex);
}
try
{
using (Settings settings = new MPSettings())
{
BasicHomeScreenName = settings.GetValueAsString(CFG_SECTION, CFG_BASICHOMESCREEN_NAME, BasicHomeScreenName);
siteOrder = (SiteOrder)settings.GetValueAsInt(CFG_SECTION, CFG_SITEVIEW_ORDER, (int)SiteOrder.AsInFile);
currentGroupView = (GUIFacadeControl.Layout)settings.GetValueAsInt(CFG_SECTION, CFG_GROUPVIEW_MODE, (int)GUIFacadeControl.Layout.List);
currentSiteView = (GUIFacadeControl.Layout)settings.GetValueAsInt(CFG_SECTION, CFG_SITEVIEW_MODE, (int)GUIFacadeControl.Layout.List);
currentCategoryView = (GUIFacadeControl.Layout)settings.GetValueAsInt(CFG_SECTION, CFG_CATEGORYVIEW_MODE, (int)GUIFacadeControl.Layout.List);
currentVideoView = (GUIFacadeControl.Layout)settings.GetValueAsInt(CFG_SECTION, CFG_VIDEOVIEW_MODE, (int)GUIFacadeControl.Layout.SmallIcons);
ovsconf.ThumbsDir = settings.GetValueAsString(CFG_SECTION, CFG_THUMBNAIL_DIR, ovsconf.ThumbsDir).Replace("/", @"\");
if (!ovsconf.ThumbsDir.EndsWith(@"\")) ovsconf.ThumbsDir = ovsconf.ThumbsDir + @"\"; // fix thumbnail dir to include the trailing slash
try { if (!string.IsNullOrEmpty(ovsconf.ThumbsDir) && !Directory.Exists(ovsconf.ThumbsDir)) Directory.CreateDirectory(ovsconf.ThumbsDir); }
catch (Exception e) { Log.Instance.Error("Failed to create thumb dir: {0}", e.ToString()); }
ThumbsAge = settings.GetValueAsInt(CFG_SECTION, CFG_THUMBNAIL_AGE, ThumbsAge);
Log.Instance.Info("Thumbnails will be stored in {0} with a maximum age of {1} days.", ovsconf.ThumbsDir, ThumbsAge);
ovsconf.DownloadDir = settings.GetValueAsString(CFG_SECTION, CFG_DOWNLOAD_DIR, "");
try { if (!string.IsNullOrEmpty(ovsconf.DownloadDir) && !Directory.Exists(ovsconf.DownloadDir)) Directory.CreateDirectory(ovsconf.DownloadDir); }
catch (Exception e) { Log.Instance.Error("Failed to create download dir: {0}", e.ToString()); }
ovsconf.CacheTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_CACHE_TIMEOUT, ovsconf.CacheTimeout);
ovsconf.UseAgeConfirmation = settings.GetValueAsBool(CFG_SECTION, CFG_USE_AGECONFIRMATION, ovsconf.UseAgeConfirmation);
ovsconf.UtilTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_UTIL_TIMEOUT, ovsconf.UtilTimeout);
ovsconf.DynamicCategoryTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_CATEGORYDISCOVERED_TIMEOUT, ovsconf.DynamicCategoryTimeout);
// set an almost random string by default -> user must enter pin in Configuration before beeing able to watch adult sites
pinAgeConfirmation = settings.GetValueAsString(CFG_SECTION, CFG_PIN_AGECONFIRMATION, DateTime.Now.Millisecond.ToString());
useQuickSelect = settings.GetValueAsBool(CFG_SECTION, CFG_USE_QUICKSELECT, useQuickSelect);
wmpbuffer = settings.GetValueAsInt(CFG_SECTION, CFG_WMP_BUFFER, wmpbuffer);
playbuffer = settings.GetValueAsInt(CFG_SECTION, CFG_PLAY_BUFFER, playbuffer);
email = settings.GetValueAsString(CFG_SECTION, CFG_EMAIL, "");
password = settings.GetValueAsString(CFG_SECTION, CFG_PASSWORD, "");
string lsFilter = settings.GetValueAsString(CFG_SECTION, CFG_FILTER, "").Trim();
FilterArray = lsFilter != "" ? lsFilter.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries) : null;
searchHistoryNum = settings.GetValueAsInt(CFG_SECTION, CFG_SEARCHHISTORY_NUM, searchHistoryNum);
searchHistoryType = (SearchHistoryType)settings.GetValueAsInt(CFG_SECTION, CFG_SEARCHHISTORYTYPE, (int)searchHistoryType);
string searchHistoryXML = settings.GetValueAsString(CFG_SECTION, CFG_SEARCHHISTORY, "").Trim();
if ("" != searchHistoryXML)
{
try
{
byte[] searchHistoryBytes = System.Text.Encoding.UTF8.GetBytes(searchHistoryXML);
MemoryStream xmlMem = new MemoryStream(searchHistoryBytes);
xmlMem.Position = 0;
System.Runtime.Serialization.DataContractSerializer dcs = new System.Runtime.Serialization.DataContractSerializer(typeof(Dictionary<string, List<string>>));
searchHistory = (Dictionary<string, List<string>>)dcs.ReadObject(xmlMem);
}
catch (Exception e)
{
//.........这里部分代码省略.........