本文整理汇总了C#中MPSettings.RemoveEntry方法的典型用法代码示例。如果您正苦于以下问题:C# MPSettings.RemoveEntry方法的具体用法?C# MPSettings.RemoveEntry怎么用?C# MPSettings.RemoveEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MPSettings
的用法示例。
在下文中一共展示了MPSettings.RemoveEntry方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetValue
public void SetValue(string key, string value, bool encrypt = false)
{
using (Settings settings = new MPSettings())
{
if (encrypt) value = EncryptionUtils.SymEncryptLocalPC(value);
if (string.IsNullOrWhiteSpace(value))
settings.RemoveEntry(PluginConfiguration.CFG_SECTION, key);
else
settings.SetValue(PluginConfiguration.CFG_SECTION, key, value);
}
}
示例2: SaveSettings
private void SaveSettings()
{
using (Settings xmlwriter = new MPSettings())
{
xmlwriter.SetValueAsBool("general", "autochangerefreshrate", btnEnableDynamicRefreshRate.Selected);
xmlwriter.SetValueAsBool("general", "notify_on_refreshrate", btnNotify.Selected);
xmlwriter.SetValueAsBool("general", "use_default_hz", btnUseDefaultRefreshRate.Selected);
xmlwriter.SetValueAsBool("general", "devicereset", btnUseDeviceReset.Selected);
xmlwriter.SetValueAsBool("general", "force_refresh_rate", btnForceRefreshRateChange.Selected);
if (_defaultHzIndex >= 0)
{
string rate = RefreshRateData(lcRefreshRatesList.ListItems[_defaultHzIndex]).Refreshrate;
xmlwriter.SetValue("general", "default_hz", rate);
}
else
{
xmlwriter.SetValue("general", "default_hz", string.Empty);
}
//delete all refreshrate entries, then re-add them.
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;
}
xmlwriter.RemoveEntry("general", name + "_fps");
xmlwriter.RemoveEntry("general", name + "_hz");
xmlwriter.RemoveEntry("general", "refreshrate0" + Convert.ToString(i) + "_ext");
xmlwriter.RemoveEntry("general", "refreshrate0" + Convert.ToString(i) + "_name");
}
int j = 1;
foreach (GUIListItem item in lcRefreshRatesList.ListItems)
{
string name = RefreshRateData(item).Name;
string fps = RefreshRateData(item).FrameRate;
string hz = RefreshRateData(item).Refreshrate;
string extCmd = RefreshRateData(item).Action;
xmlwriter.SetValue("general", name + "_fps", fps);
xmlwriter.SetValue("general", name + "_hz", hz);
xmlwriter.SetValue("general", "refreshrate0" + Convert.ToString(j) + "_ext", extCmd);
xmlwriter.SetValue("general", "refreshrate0" + Convert.ToString(j) + "_name", name);
j++;
}
}
}
示例3: SetDefaultGrabber
//.........这里部分代码省略.........
}
_grabberList = new Dictionary<string, ComboBoxItemDatabase>();
Directory.CreateDirectory(IMDB.ScriptDirectory);
DirectoryInfo di = new DirectoryInfo(IMDB.ScriptDirectory);
FileInfo[] fileList = di.GetFiles("*.csscript", SearchOption.AllDirectories);
GUIWaitCursor.Show();
foreach (FileInfo f in fileList)
{
try
{
CSScript.GlobalSettings.AddSearchDir(AppDomain.CurrentDomain.BaseDirectory);
using (AsmHelper script = new AsmHelper(CSScript.Compile(f.FullName), "Temp", true))
{
script.ProbingDirs = CSScript.GlobalSettings.SearchDirs.Split(';');
IIMDBScriptGrabber grabber = (IIMDBScriptGrabber) script.CreateObject("Grabber");
ComboBoxItemDatabase item = new ComboBoxItemDatabase();
item.Database = Path.GetFileNameWithoutExtension(f.FullName);
item.Language = grabber.GetLanguage();
item.Limit = IMDB.DEFAULT_SEARCH_LIMIT.ToString();
item.Name = grabber.GetName();
_grabberList.Add(item.Database, item);
}
}
catch (Exception ex)
{
Log.Error("Script grabber error file: {0}, message : {1}", f.FullName, ex.Message);
}
}
string defaultDatabase = string.Empty;
int defaultIndex = 0;
int dbNumber;
using (Profile.Settings xmlreader = new MPSettings())
{
defaultDatabase = xmlreader.GetValueAsString("moviedatabase", "database" + 0, "IMDB");
dbNumber = xmlreader.GetValueAsInt("moviedatabase", "number", 0);
}
foreach (KeyValuePair<string, ComboBoxItemDatabase> grabber in _grabberList)
{
dlg.Add(grabber.Value.Name + " - " + grabber.Value.Language);
if (defaultDatabase == grabber.Key)
{
dlg.SelectedLabel = defaultIndex;
}
else
{
defaultIndex++;
}
}
GUIWaitCursor.Hide();
dlg.DoModal(GUIWindowManager.ActiveWindow);
if (dlg.SelectedId == -1)
{
return;
}
using (Profile.Settings xmlwriter = new MPSettings())
{
KeyValuePair<string, ComboBoxItemDatabase> grabber = _grabberList.ElementAt(dlg.SelectedLabel);
if (grabber.Key != "IMDB")
{
if (dbNumber == 0)
{
dbNumber = 1;
}
xmlwriter.SetValue("moviedatabase", "number", dbNumber);
xmlwriter.SetValue("moviedatabase", "database" + 0, grabber.Key);
xmlwriter.SetValue("moviedatabase", "title" + 0, grabber.Value.Name);
xmlwriter.SetValue("moviedatabase", "language" + 0, grabber.Value.Language);
xmlwriter.SetValue("moviedatabase", "limit" + 0, 25);
}
else
{
for (int i = 0; i < 4; i++)
{
xmlwriter.SetValue("moviedatabase", "number", 0);
xmlwriter.RemoveEntry("moviedatabase", "database" + i);
xmlwriter.RemoveEntry("moviedatabase", "title" + i);
xmlwriter.RemoveEntry("moviedatabase", "language" + i);
xmlwriter.RemoveEntry("moviedatabase", "limit" + i);
}
}
}
IMDB.MovieInfoDatabase.ResetGrabber();
}
示例4: 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)
//.........这里部分代码省略.........
示例5: SaveSettings
public override void SaveSettings()
{
LoadAll();
using (Settings xmlwriter = new MPSettings())
{
foreach (ListViewItem item in listViewPlugins.Items)
{
ItemTag itemTag = (ItemTag) item.Tag;
bool isEnabled = itemTag.IsEnabled;
bool isHome = itemTag.IsHome;
bool isPlugins = itemTag.IsPlugins;
if (itemTag.IsIncompatible)
{
continue;
}
xmlwriter.SetValueAsBool("plugins", itemTag.SetupForm.PluginName(), isEnabled);
xmlwriter.SetValueAsBool("pluginsdlls", itemTag.DllName, isEnabled);
if ((isEnabled) && (!isHome && !isPlugins))
{
isHome = true;
}
if (itemTag.IsWindow)
{
xmlwriter.SetValueAsBool("home", itemTag.SetupForm.PluginName(), isHome);
xmlwriter.SetValueAsBool("myplugins", itemTag.SetupForm.PluginName(), isPlugins);
xmlwriter.SetValueAsBool("pluginswindows", itemTag.Type, isEnabled);
}
}
// Remove PS++ entries
xmlwriter.RemoveEntry("plugins", "PowerScheduler++");
xmlwriter.RemoveEntry("home", "PowerScheduler++");
xmlwriter.RemoveEntry("myplugins", "PowerScheduler++");
xmlwriter.RemoveEntry("pluginswindows", "PowerScheduler++");
}
}
示例6: SaveSettings
public override void SaveSettings()
{
using (Settings xmlwriter = new MPSettings())
{
xmlwriter.SetValueAsBool("general", "autochangerefreshrate", chkEnableDynamicRR.Checked);
xmlwriter.SetValueAsBool("general", "notify_on_refreshrate", chkNotifyOnRR.Checked);
xmlwriter.SetValueAsBool("general", "use_default_hz", chkUseDefaultRR.Checked);
xmlwriter.SetValueAsBool("general", "devicereset", chkUseDeviceReset.Checked);
xmlwriter.SetValueAsBool("general", "force_refresh_rate", chkForceRR.Checked);
xmlwriter.SetValue("general", "default_hz", sDefaultHz);
/*
// example
<entry name="refreshrate01_ext">C:\\Program Files\\displaychanger\\dc.exe -refreshrate=60 -apply -quiet</entry>
<entry name="refreshrate01_name">NTSC</entry>
<entry name="ntsc_fps">29.97;30</entry>
<entry name="ntsc_hz">60</entry>
*/
//delete all refreshrate entries, then re-add them.
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;
}
xmlwriter.RemoveEntry("general", name + "_fps");
xmlwriter.RemoveEntry("general", name + "_hz");
xmlwriter.RemoveEntry("general", "refreshrate0" + Convert.ToString(i) + "_ext");
xmlwriter.RemoveEntry("general", "refreshrate0" + Convert.ToString(i) + "_name");
}
int j = 1;
foreach (DataGridViewRow row in dataGridViewRR.Rows)
{
string name = (string)row.Cells[0].Value;
string fps = (string)row.Cells[1].Value;
string hz = (string)row.Cells[2].Value;
string extCmd = (string)row.Cells[3].Value;
xmlwriter.SetValue("general", name + "_fps", fps);
xmlwriter.SetValue("general", name + "_hz", hz);
xmlwriter.SetValue("general", "refreshrate0" + Convert.ToString(j) + "_ext", extCmd);
xmlwriter.SetValue("general", "refreshrate0" + Convert.ToString(j) + "_name", name);
j++;
}
}
}
示例7: SaveSettings
public void SaveSettings(string section)
{
if (AddOpticalDiskDrives)
{
AddStaticShares(DriveType.DVD, "DVD");
}
using (Profile.Settings xmlwriter = new MPSettings())
{
string defaultShare = string.Empty;
for (int index = 0; index < 128; index++)
{
string shareName = String.Format("sharename{0}", index);
string sharePath = String.Format("sharepath{0}", index);
string sharePin = String.Format("pincode{0}", index);
string shareType = String.Format("sharetype{0}", index);
string shareServer = String.Format("shareserver{0}", index);
string shareLogin = String.Format("sharelogin{0}", index);
string sharePwd = String.Format("sharepassword{0}", index);
string sharePort = String.Format("shareport{0}", index);
string shareRemotePath = String.Format("shareremotepath{0}", index);
string shareViewPath = String.Format("shareview{0}", index);
xmlwriter.RemoveEntry(section, shareName);
xmlwriter.RemoveEntry(section, sharePath);
xmlwriter.RemoveEntry(section, sharePin);
xmlwriter.RemoveEntry(section, shareType);
xmlwriter.RemoveEntry(section, shareServer);
xmlwriter.RemoveEntry(section, shareLogin);
xmlwriter.RemoveEntry(section, sharePwd);
xmlwriter.RemoveEntry(section, sharePort);
xmlwriter.RemoveEntry(section, shareRemotePath);
xmlwriter.RemoveEntry(section, shareViewPath);
if (section == "music" || section == "movies")
{
string shareScan = String.Format("sharescan{0}", index);
xmlwriter.RemoveEntry(section, shareScan);
}
if (section == "movies")
{
string thumbs = String.Format("videothumbscreate{0}", index);
xmlwriter.RemoveEntry(section, thumbs);
string movieFolder = String.Format("eachfolderismovie{0}", index);
xmlwriter.RemoveEntry(section, movieFolder);
}
string shareNameData = string.Empty;
string sharePathData = string.Empty;
string sharePinData = string.Empty;
bool shareTypeData = false;
string shareServerData = string.Empty;
string shareLoginData = string.Empty;
string sharePwdData = string.Empty;
int sharePortData = 21;
string shareRemotePathData = string.Empty;
int shareLayout = (int)MediaPortal.GUI.Library.GUIFacadeControl.Layout.List;
bool shareScanData = false;
//ThumbsCreate (default true)
bool thumbsCreate = true;
bool folderIsMovie = false;
if (_shareListControl != null && _shareListControl.Count > index)
{
ShareData shareData = _shareListControl[index].AlbumInfoTag as ShareData;
if (shareData != null && !String.IsNullOrEmpty(shareData.Name))
{
shareNameData = shareData.Name;
sharePathData = shareData.Folder;
sharePinData = shareData.PinCode;
shareTypeData = shareData.IsRemote;
shareServerData = shareData.Server;
shareLoginData = shareData.LoginName;
sharePwdData = shareData.PassWord;
sharePortData = shareData.Port;
shareRemotePathData = shareData.RemoteFolder;
shareLayout = (int)shareData.DefaultLayout;
shareScanData = shareData.ScanShare;
// ThumbsCreate
thumbsCreate = shareData.CreateThumbs;
folderIsMovie = shareData.EachFolderIsMovie;
if (shareNameData == _defaultShare)
{
defaultShare = shareNameData;
}
xmlwriter.SetValue(section, shareName, shareNameData);
xmlwriter.SetValue(section, sharePath, sharePathData);
xmlwriter.SetValue(section, sharePin, Util.Utils.EncryptPassword(sharePinData));
xmlwriter.SetValueAsBool(section, shareType, shareTypeData);
xmlwriter.SetValue(section, shareServer, shareServerData);
xmlwriter.SetValue(section, shareLogin, shareLoginData);
xmlwriter.SetValue(section, sharePwd, Util.Utils.EncryptPassword(sharePwdData));
xmlwriter.SetValue(section, sharePort, sharePortData.ToString());
xmlwriter.SetValue(section, shareRemotePath, shareRemotePathData);
//.........这里部分代码省略.........
示例8: SetDefaultDrives
public void SetDefaultDrives(string section, bool addOpticalDrives)
{
using (Profile.Settings xmlwriter = new MPSettings())
{
for (int index = 0; index < 128; index++)
{
string shareName = String.Format("sharename{0}", index);
string sharePath = String.Format("sharepath{0}", index);
string sharePin = String.Format("pincode{0}", index);
string shareType = String.Format("sharetype{0}", index);
string shareServer = String.Format("shareserver{0}", index);
string shareLogin = String.Format("sharelogin{0}", index);
string sharePwd = String.Format("sharepassword{0}", index);
string sharePort = String.Format("shareport{0}", index);
string shareRemotePath = String.Format("shareremotepath{0}", index);
string shareViewPath = String.Format("shareview{0}", index);
xmlwriter.RemoveEntry(section, shareName);
xmlwriter.RemoveEntry(section, sharePath);
xmlwriter.RemoveEntry(section, sharePin);
xmlwriter.RemoveEntry(section, shareType);
xmlwriter.RemoveEntry(section, shareServer);
xmlwriter.RemoveEntry(section, shareLogin);
xmlwriter.RemoveEntry(section, sharePwd);
xmlwriter.RemoveEntry(section, sharePort);
xmlwriter.RemoveEntry(section, shareRemotePath);
xmlwriter.RemoveEntry(section, shareViewPath);
}
}
switch (section)
{
case "movies":
VirtualDirectory.SetInitialDefaultShares(false, false, false, true);
break;
case "music":
VirtualDirectory.SetInitialDefaultShares(false, true, false, false);
break;
case "pictures":
VirtualDirectory.SetInitialDefaultShares(false, false, true, false);
break;
}
}
示例9: PerformMaintenance
/// <summary>
/// Perform any maintenance tasks on the settings
/// </summary>
internal static void PerformMaintenance()
{
TraktLogger.Info("Performing maintenance tasks");
using (Settings xmlreader = new MPSettings())
{
int currentSettingsVersion = xmlreader.GetValueAsInt(cTrakt, cSettingsVersion, SettingsVersion);
// check if any maintenance task is required
if (currentSettingsVersion >= SettingsVersion) return;
// upgrade settings for each version
while (currentSettingsVersion < SettingsVersion)
{
switch (currentSettingsVersion)
{
case 0:
xmlreader.RemoveEntry(cTrakt, cLastActivityLoad);
xmlreader.RemoveEntry(cTrakt, cLastTrendingMovies);
xmlreader.RemoveEntry(cTrakt, cLastTrendingShows);
xmlreader.RemoveEntry(cTrakt, cLastStatistics);
currentSettingsVersion++;
break;
case 1:
// trailers plugin now supports tvshows, seasons and episodes.
xmlreader.SetValueAsBool(cTrakt, "UseTrailersPlugin", true);
currentSettingsVersion++;
break;
case 2:
// Only use Trailers plugin now for Trailers functionality.
xmlreader.RemoveEntry(cTrakt, "UseTrailersPlugin");
xmlreader.RemoveEntry(cTrakt, "DefaultTVShowTrailerSite");
xmlreader.RemoveEntry(cTrakt, "DefaultMovieTrailerSite");
// Remove old activity settings
xmlreader.RemoveEntry(cTrakt, "ShowCommunityActivity");
xmlreader.RemoveEntry(cTrakt, "IncludeMeInFriendsActivity");
// Remove old category/filter node ids for MovingPictures (not needed)
xmlreader.RemoveEntry(cTrakt, "MovingPicturesCategoryId");
xmlreader.RemoveEntry(cTrakt, "MovingPicturesFilterId");
currentSettingsVersion++;
break;
case 3:
// Remove 4TR / My Anime plugin handlers (plugins no longer developed or superceded)
xmlreader.RemoveEntry(cTrakt, "ForTheRecordRecordings");
xmlreader.RemoveEntry(cTrakt, "ForTheRecordTVLive");
xmlreader.RemoveEntry(cTrakt, "MyAnime");
// Clear existing passwords as they're no longer hashed in new API v2
xmlreader.RemoveEntry(cTrakt, cPassword);
xmlreader.RemoveEntry(cTrakt, cUserLogins);
// Remove Advanced Rating setting, there is only one now
xmlreader.RemoveEntry(cTrakt, "ShowAdvancedRatingsDialog");
// Remove SkippedMovies and AlreadyExistMovies as data structures changed
xmlreader.RemoveEntry(cTrakt, "SkippedMovies");
xmlreader.RemoveEntry(cTrakt, "AlreadyExistMovies");
// Remove old show collection cache
xmlreader.RemoveEntry(cTrakt, "ShowsInCollection");
// Reset some defaults
xmlreader.RemoveEntry(cTrakt, cSyncRatings);
xmlreader.RemoveEntry(cTrakt, cDashboardActivityPollInterval);
xmlreader.RemoveEntry(cTrakt, cDashboardTrendingPollInterval);
xmlreader.RemoveEntry(cTrakt, cDashboardLoadDelay);
xmlreader.RemoveEntry(cTrakt, cShowRateDlgForPlaylists);
xmlreader.RemoveEntry(cTrakt, cSearchTypes);
// Remove any persisted data that has changed with with new API v2
try
{
if (File.Exists(cLastActivityFileCache)) File.Delete(cLastActivityFileCache);
if (File.Exists(cLastTrendingShowFileCache)) File.Delete(cLastTrendingShowFileCache);
if (File.Exists(cLastTrendingMovieFileCache)) File.Delete(cLastTrendingMovieFileCache);
if (File.Exists(cLastStatisticsFileCache)) File.Delete(cLastStatisticsFileCache);
// Remove old artwork - filenames have changed
string imagePath = Config.GetFolder(Config.Dir.Thumbs) + "\\Trakt";
if (Directory.Exists(imagePath))
{
Directory.Delete(imagePath, true);
}
}
catch (Exception e)
{
TraktLogger.Error("Failed to remove v1 API persisted data from disk, Reason = '{0}'", e.Message);
}
currentSettingsVersion++;
break;
//.........这里部分代码省略.........
示例10: OnSetDefaultGrabber
private void OnSetDefaultGrabber()
{
// read index file
if (!File.Exists(_grabberIndexFile))
{
GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
dlgOk.SetHeading(257);
dlgOk.SetLine(1, GUILocalizeStrings.Get(300033)); // No grabber index found
dlgOk.DoModal(GetID);
return;
}
GUIWaitCursor.Show();
GetGrabbers();
string defaultDatabase = string.Empty;
int defaultIndex = 0;
int dbNumber;
using (MediaPortal.Profile.Settings xmlreader = new MPSettings())
{
defaultDatabase = xmlreader.GetValueAsString("moviedatabase", "database" + 0, "IMDB");
dbNumber = xmlreader.GetValueAsInt("moviedatabase", "number", 0);
}
// Dialog menu with grabbers
GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
if (dlg == null)
{
return;
}
dlg.Reset();
dlg.SetHeading(300036); // Set default Grabber script
foreach (KeyValuePair<string, IIMDBScriptGrabber> grabber in _grabberList)
{
dlg.Add(grabber.Value.GetName() + " - " + grabber.Value.GetLanguage());
if (defaultDatabase == grabber.Key)
{
dlg.SelectedLabel = defaultIndex;
}
else
{
defaultIndex++;
}
}
GUIWaitCursor.Hide();
dlg.DoModal(GetID);
if (dlg.SelectedId == -1)
{
return;
}
using (MediaPortal.Profile.Settings xmlwriter = new MPSettings())
{
KeyValuePair<string, IIMDBScriptGrabber> grabber = _grabberList.ElementAt(dlg.SelectedLabel);
if (grabber.Key != "IMDB")
{
if (dbNumber == 0)
{
dbNumber = 1;
}
xmlwriter.SetValue("moviedatabase", "number", dbNumber);
xmlwriter.SetValue("moviedatabase", "database" + 0, grabber.Key);
xmlwriter.SetValue("moviedatabase", "title" + 0, grabber.Value.GetName());
xmlwriter.SetValue("moviedatabase", "language" + 0, grabber.Value.GetLanguage());
xmlwriter.SetValue("moviedatabase", "limit" + 0, 25);
}
else
{
for (int i = 0; i < 4; i++)
{
xmlwriter.SetValue("moviedatabase", "number", 0);
xmlwriter.RemoveEntry("moviedatabase", "database" + i);
xmlwriter.RemoveEntry("moviedatabase", "title" + i);
xmlwriter.RemoveEntry("moviedatabase", "language" + i);
xmlwriter.RemoveEntry("moviedatabase", "limit" + i);
}
}
}
}
示例11: SaveSettings
protected void SaveSettings(string section)
{
if (AddOpticalDiskDrives)
{
AddStaticShares(DriveType.DVD, "DVD");
}
using (Settings xmlwriter = new MPSettings())
{
string defaultShare = string.Empty;
for (int index = 0; index < MaximumShares; index++)
{
string shareName = String.Format("sharename{0}", index);
string sharePath = String.Format("sharepath{0}", index);
string sharePin = String.Format("pincode{0}", index);
string shareType = String.Format("sharetype{0}", index);
string shareServer = String.Format("shareserver{0}", index);
string shareLogin = String.Format("sharelogin{0}", index);
string sharePwd = String.Format("sharepassword{0}", index);
string sharePort = String.Format("shareport{0}", index);
string shareRemotePath = String.Format("shareremotepath{0}", index);
string shareViewPath = String.Format("shareview{0}", index);
string sharewakeonlan = String.Format("sharewakeonlan{0}", index);
string sharedonotfolderjpgifpin = String.Format("sharedonotfolderjpgifpin{0}", index);
xmlwriter.RemoveEntry(section, shareName);
xmlwriter.RemoveEntry(section, sharePath);
xmlwriter.RemoveEntry(section, sharePin);
xmlwriter.RemoveEntry(section, shareType);
xmlwriter.RemoveEntry(section, shareServer);
xmlwriter.RemoveEntry(section, shareLogin);
xmlwriter.RemoveEntry(section, sharePwd);
xmlwriter.RemoveEntry(section, sharePort);
xmlwriter.RemoveEntry(section, shareRemotePath);
xmlwriter.RemoveEntry(section, shareViewPath);
xmlwriter.RemoveEntry(section, sharewakeonlan);
xmlwriter.RemoveEntry(section, sharedonotfolderjpgifpin);
if (section == "music" || section == "movies")
{
string shareScan = String.Format("sharescan{0}", index);
xmlwriter.RemoveEntry(section, shareScan);
}
if (section == "movies")
{
string thumbs = String.Format("videothumbscreate{0}", index);
xmlwriter.RemoveEntry(section, thumbs);
string movieFolder = String.Format("eachfolderismovie{0}", index);
xmlwriter.RemoveEntry(section, movieFolder);
}
string shareNameData = string.Empty;
string sharePathData = string.Empty;
string sharePinData = string.Empty;
bool shareTypeData = false;
string shareServerData = string.Empty;
string shareLoginData = string.Empty;
string sharePwdData = string.Empty;
int sharePortData = 21;
string shareRemotePathData = string.Empty;
int shareLayout = (int)MediaPortal.GUI.Library.GUIFacadeControl.Layout.List;
bool shareScanData = false;
//ThumbsCreate (default true)
bool thumbsCreate = true;
bool folderIsMovie = false;
bool shareWakeOnLan = false;
bool sharedonotFolderJpgIfPin = true;
if (CurrentShares != null && CurrentShares.Count > index)
{
ShareData shareData = CurrentShares[index].Tag as ShareData;
if (shareData != null && !String.IsNullOrEmpty(shareData.Name))
{
shareNameData = shareData.Name;
sharePathData = shareData.Folder;
sharePinData = shareData.PinCode;
shareTypeData = shareData.IsRemote;
shareServerData = shareData.Server;
shareLoginData = shareData.LoginName;
sharePwdData = shareData.PassWord;
sharePortData = shareData.Port;
shareRemotePathData = shareData.RemoteFolder;
shareLayout = (int)shareData.DefaultLayout;
shareScanData = shareData.ScanShare;
// ThumbsCreate
thumbsCreate = shareData.CreateThumbs;
folderIsMovie = shareData.EachFolderIsMovie;
shareWakeOnLan = shareData.EnableWakeOnLan;
sharedonotFolderJpgIfPin = shareData.DonotFolderJpgIfPin;
if (CurrentShares[index] == DefaultShare)
{
defaultShare = shareNameData;
}
xmlwriter.SetValue(section, shareName, shareNameData);
//.........这里部分代码省略.........
示例12: Save
public void Save(bool saveOnlyRuntimeModifyable)
{
OnlineVideos.OnlineVideoSettings ovsconf = OnlineVideos.OnlineVideoSettings.Instance;
try
{
using (Settings settings = new MPSettings())
{
settings.SetValue(CFG_SECTION, CFG_GROUPVIEW_MODE, (int)currentGroupView);
settings.SetValue(CFG_SECTION, CFG_SITEVIEW_MODE, (int)currentSiteView);
settings.SetValue(CFG_SECTION, CFG_SITEVIEW_ORDER, (int)siteOrder);
settings.SetValue(CFG_SECTION, CFG_VIDEOVIEW_MODE, (int)currentVideoView);
settings.SetValue(CFG_SECTION, CFG_CATEGORYVIEW_MODE, (int)currentCategoryView);
if (lastFirstRun != default(DateTime)) settings.SetValue(CFG_SECTION, CFG_LAST_FIRSTRUN, lastFirstRun.ToString("s"));
try
{
MemoryStream xmlMem = new MemoryStream();
DataContractSerializer dcs = new DataContractSerializer(typeof(Dictionary<string, List<string>>));
dcs.WriteObject(xmlMem, searchHistory);
xmlMem.Position = 0;
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlMem);
settings.SetValue(CFG_SECTION, CFG_SEARCHHISTORY, xmlDoc.InnerXml);
}
catch (Exception e)
{
Log.Instance.Warn("Error saving search history to configuration: {0}:{1}! Will be reset on next load...", e.GetType(), e.Message);
searchHistory = null;
settings.SetValue(CFG_SECTION, CFG_SEARCHHISTORY, "");
}
if (!saveOnlyRuntimeModifyable)
{
settings.SetValue(CFG_SECTION, CFG_BASICHOMESCREEN_NAME, BasicHomeScreenName);
settings.SetValue(CFG_SECTION, CFG_THUMBNAIL_DIR, ovsconf.ThumbsDir);
settings.SetValue(CFG_SECTION, CFG_THUMBNAIL_AGE, ThumbsAge);
settings.SetValueAsBool(CFG_SECTION, CFG_USE_AGECONFIRMATION, ovsconf.UseAgeConfirmation);
settings.SetValue(CFG_SECTION, CFG_PIN_AGECONFIRMATION, pinAgeConfirmation);
settings.SetValueAsBool(CFG_SECTION, CFG_USE_QUICKSELECT, useQuickSelect);
settings.SetValue(CFG_SECTION, CFG_CACHE_TIMEOUT, ovsconf.CacheTimeout);
settings.SetValue(CFG_SECTION, CFG_UTIL_TIMEOUT, ovsconf.UtilTimeout);
settings.SetValue(CFG_SECTION, CFG_CATEGORYDISCOVERED_TIMEOUT, ovsconf.DynamicCategoryTimeout);
settings.SetValue(CFG_SECTION, CFG_WMP_BUFFER, wmpbuffer);
settings.SetValue(CFG_SECTION, CFG_PLAY_BUFFER, playbuffer);
settings.SetValue(CFG_SECTION, CFG_UPDATEPERIOD, updatePeriod);
if (FilterArray != null && FilterArray.Length > 0) settings.SetValue(CFG_SECTION, CFG_FILTER, string.Join(",", FilterArray));
if (!string.IsNullOrEmpty(ovsconf.DownloadDir)) settings.SetValue(CFG_SECTION, CFG_DOWNLOAD_DIR, ovsconf.DownloadDir);
if (!string.IsNullOrEmpty(email)) settings.SetValue(CFG_SECTION, CFG_EMAIL, email);
if (!string.IsNullOrEmpty(password)) settings.SetValue(CFG_SECTION, CFG_PASSWORD, password);
if (updateOnStart == null) settings.RemoveEntry(CFG_SECTION, CFG_UPDATEONSTART);
else settings.SetValueAsBool(CFG_SECTION, CFG_UPDATEONSTART, updateOnStart.Value);
settings.SetValue(CFG_SECTION, CFG_SEARCHHISTORY_NUM, searchHistoryNum);
settings.SetValue(CFG_SECTION, CFG_SEARCHHISTORYTYPE, (int)searchHistoryType);
settings.SetValueAsBool(CFG_SECTION, CFG_AUTO_LANG_GROUPS, autoGroupByLang);
settings.SetValueAsBool(CFG_SECTION, CFG_FAVORITES_FIRST, ovsconf.FavoritesFirst);
settings.SetValueAsBool(CFG_SECTION, CFG_LATESTVIDEOS_RANDOMIZE, LatestVideosRandomize);
settings.SetValue(CFG_SECTION, CFG_LATESTVIDEOS_MAXITEMS, LatestVideosMaxItems);
settings.SetValue(CFG_SECTION, CFG_LATESTVIDEOS_ONLINEDATA_REFRESH, LatestVideosOnlineDataRefresh);
settings.SetValue(CFG_SECTION, CFG_LATESTVIDEOS_GUIDATA_REFRESH, LatestVideosGuiDataRefresh);
settings.SetValueAsBool(CFG_SECTION, CFG_ALLOW_REFRESHRATE_CHANGE, AllowRefreshRateChange);
settings.SetValueAsBool(CFG_SECTION, CFG_STORE_LAYOUT_PER_CATEGORY, StoreLayoutPerCategory);
SaveSitesGroups();
ovsconf.SaveSites();
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_HTTP_PREFERRED_NETWORK_INTERFACE, ovsconf.HttpPreferredNetworkInterface);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_HTTP_OPEN_CONNECTION_TIMEOUT, ovsconf.HttpOpenConnectionTimeout);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_HTTP_OPEN_CONNECTION_SLEEP_TIME, ovsconf.HttpOpenConnectionSleepTime);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_HTTP_TOTAL_REOPEN_CONNECTION_TIMEOUT, ovsconf.HttpTotalReopenConnectionTimeout);
settings.SetValueAsBool(CFG_SECTION, CFG_FILTER_V2_HTTP_SERVER_AUTHENTICATE, ovsconf.HttpServerAuthenticate);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_HTTP_SERVER_USER_NAME, ovsconf.HttpServerUserName);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_HTTP_SERVER_PASSWORD, ovsconf.HttpServerPassword);
settings.SetValueAsBool(CFG_SECTION, CFG_FILTER_V2_HTTP_PROXY_SERVER_AUTHENTICATE, ovsconf.HttpProxyServerAuthenticate);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_HTTP_PROXY_SERVER, ovsconf.HttpProxyServer);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_HTTP_PROXY_SERVER_PORT, ovsconf.HttpProxyServerPort);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_HTTP_PROXY_SERVER_USER_NAME, ovsconf.HttpProxyServerUserName);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_HTTP_PROXY_SERVER_PASSWORD, ovsconf.HttpProxyServerPassword);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_HTTP_PROXY_SERVER_TYPE, (int)ovsconf.HttpProxyServerType);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_RTMP_PREFERRED_NETWORK_INTERFACE, ovsconf.RtmpPreferredNetworkInterface);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_RTMP_OPEN_CONNECTION_TIMEOUT, ovsconf.RtmpOpenConnectionTimeout);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_RTMP_OPEN_CONNECTION_SLEEP_TIME, ovsconf.RtmpOpenConnectionSleepTime);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_RTMP_TOTAL_REOPEN_CONNECTION_TIMEOUT, ovsconf.RtmpTotalReopenConnectionTimeout);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_RTSP_PREFERRED_NETWORK_INTERFACE, ovsconf.RtspPreferredNetworkInterface);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_RTSP_OPEN_CONNECTION_TIMEOUT, ovsconf.RtspOpenConnectionTimeout);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_RTSP_OPEN_CONNECTION_SLEEP_TIME, ovsconf.RtspOpenConnectionSleepTime);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_RTSP_TOTAL_REOPEN_CONNECTION_TIMEOUT, ovsconf.RtspTotalReopenConnectionTimeout);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_RTSP_CLIENT_PORT_MIN, ovsconf.RtspClientPortMin);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_RTSP_CLIENT_PORT_MAX, ovsconf.RtspClientPortMax);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_UDPRTP_PREFERRED_NETWORK_INTERFACE, ovsconf.UdpRtpPreferredNetworkInterface);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_UDPRTP_OPEN_CONNECTION_TIMEOUT, ovsconf.UdpRtpOpenConnectionTimeout);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_UDPRTP_OPEN_CONNECTION_SLEEP_TIME, ovsconf.UdpRtpOpenConnectionSleepTime);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_UDPRTP_TOTAL_REOPEN_CONNECTION_TIMEOUT, ovsconf.UdpRtpTotalReopenConnectionTimeout);
settings.SetValue(CFG_SECTION, CFG_FILTER_V2_UDPRTP_RECEIVE_DATA_CHECK_INTERVAL, ovsconf.UdpRtpReceiveDataCheckInterval);
}
}
}
//.........这里部分代码省略.........