当前位置: 首页>>代码示例>>C#>>正文


C# Settings.RemoveEntry方法代码示例

本文整理汇总了C#中Settings.RemoveEntry方法的典型用法代码示例。如果您正苦于以下问题:C# Settings.RemoveEntry方法的具体用法?C# Settings.RemoveEntry怎么用?C# Settings.RemoveEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Settings的用法示例。


在下文中一共展示了Settings.RemoveEntry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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();
      }
    }
开发者ID:DustinBrett,项目名称:mpNZB,代码行数:79,代码来源:frmSetup.cs

示例2: UpgradeSettings


//.........这里部分代码省略.........
            if (!string.IsNullOrEmpty(u_ImageInterval))
              xmlwriter.SetValue("FanartHandler", "ImageInterval", u_ImageInterval);
            if (!string.IsNullOrEmpty(u_MinResolution))
              xmlwriter.SetValue("FanartHandler", "MinResolution", u_MinResolution);
            if (!string.IsNullOrEmpty(u_ScraperMaxImages))
              xmlwriter.SetValue("FanartHandler", "ScraperMaxImages", u_ScraperMaxImages);
            if (!string.IsNullOrEmpty(u_ScraperMusicPlaying))
              xmlwriter.SetValue("FanartHandler", "ScraperMusicPlaying", u_ScraperMusicPlaying.Replace("True","yes").Replace("False","no"));
            if (!string.IsNullOrEmpty(u_ScraperMPDatabase))
              xmlwriter.SetValue("FanartHandler", "ScraperMPDatabase", u_ScraperMPDatabase.Replace("True","yes").Replace("False","no"));
            if (!string.IsNullOrEmpty(u_ScraperInterval))
              xmlwriter.SetValue("FanartHandler", "ScraperInterval", u_ScraperInterval.Replace("True","yes").Replace("False","no"));
            if (!string.IsNullOrEmpty(u_UseAspectRatio))
              xmlwriter.SetValue("FanartHandler", "UseAspectRatio", u_UseAspectRatio.Replace("True","yes").Replace("False","no"));
            if (!string.IsNullOrEmpty(u_ScrapeThumbnails))
              xmlwriter.SetValue("FanartHandler", "ScrapeThumbnails", u_ScrapeThumbnails.Replace("True","yes").Replace("False","no"));
            if (!string.IsNullOrEmpty(u_ScrapeThumbnailsAlbum))
              xmlwriter.SetValue("FanartHandler", "ScrapeThumbnailsAlbum", u_ScrapeThumbnailsAlbum.Replace("True","yes").Replace("False","no"));
            if (!string.IsNullOrEmpty(u_DoNotReplaceExistingThumbs))
              xmlwriter.SetValue("FanartHandler", "DoNotReplaceExistingThumbs", u_DoNotReplaceExistingThumbs.Replace("True","yes").Replace("False","no"));
            if (!string.IsNullOrEmpty(u_UseDefaultBackdrop))
              xmlwriter.SetValue("FanartHandler", "UseDefaultBackdrop", u_UseDefaultBackdrop.Replace("True","yes").Replace("False","no"));
            if (!string.IsNullOrEmpty(u_UseGenreFanart))
              xmlwriter.SetValue("FanartHandler", "UseGenreFanart", u_UseGenreFanart.Replace("True","yes").Replace("False","no"));
            if (!string.IsNullOrEmpty(u_ScanMusicFoldersForFanart))
              xmlwriter.SetValue("FanartHandler", "ScanMusicFoldersForFanart", u_ScanMusicFoldersForFanart.Replace("True","yes").Replace("False","no"));
            //
            if (!string.IsNullOrEmpty(u_AddAdditionalSeparators))
              xmlwriter.SetValue("Scraper", "AddAdditionalSeparators", u_AddAdditionalSeparators);
            #endregion
            #region Delete old Entry
            try
            {
              xmlwriter.RemoveEntry("FanartHandler", "useFanart");
              xmlwriter.RemoveEntry("FanartHandler", "useAlbum");
              xmlwriter.RemoveEntry("FanartHandler", "useArtist");
              xmlwriter.RemoveEntry("FanartHandler", "skipWhenHighResAvailable");
              xmlwriter.RemoveEntry("FanartHandler", "disableMPTumbsForRandom");
              xmlwriter.RemoveEntry("FanartHandler", "useSelectedMusicFanart");
              xmlwriter.RemoveEntry("FanartHandler", "useSelectedOtherFanart");
              xmlwriter.RemoveEntry("FanartHandler", "imageInterval");
              xmlwriter.RemoveEntry("FanartHandler", "minResolution");
              xmlwriter.RemoveEntry("FanartHandler", "scraperMaxImages");
              xmlwriter.RemoveEntry("FanartHandler", "scraperMusicPlaying");
              xmlwriter.RemoveEntry("FanartHandler", "scraperMPDatabase");
              xmlwriter.RemoveEntry("FanartHandler", "scraperInterval");
              xmlwriter.RemoveEntry("FanartHandler", "useAspectRatio");
              xmlwriter.RemoveEntry("FanartHandler", "scrapeThumbnails");
              xmlwriter.RemoveEntry("FanartHandler", "scrapeThumbnailsAlbum");
              xmlwriter.RemoveEntry("FanartHandler", "doNotReplaceExistingThumbs");
              xmlwriter.RemoveEntry("FanartHandler", "useDefaultBackdrop");

              xmlwriter.RemoveEntry("FanartHandler", "latestPictures");
              xmlwriter.RemoveEntry("FanartHandler", "latestMusic");
              xmlwriter.RemoveEntry("FanartHandler", "latestMovingPictures");
              xmlwriter.RemoveEntry("FanartHandler", "latestTVSeries");
              xmlwriter.RemoveEntry("FanartHandler", "latestTVRecordings");
              xmlwriter.RemoveEntry("FanartHandler", "refreshDbPicture");
              xmlwriter.RemoveEntry("FanartHandler", "refreshDbMusic");
              xmlwriter.RemoveEntry("FanartHandler", "latestMovingPicturesWatched");
              xmlwriter.RemoveEntry("FanartHandler", "latestTVSeriesWatched");
              xmlwriter.RemoveEntry("FanartHandler", "latestTVRecordingsWatched");
            }
            catch
            {   }
            try
开发者ID:hkjensen,项目名称:mediaportal-fanart-handler,代码行数:67,代码来源:Utils.cs


注:本文中的Settings.RemoveEntry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。