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


C# Profile.MPSettings.GetValue方法代码示例

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


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

示例1: LoadButtonNames

    protected override void LoadButtonNames()
    {
      if (menuMain == null)
      {
        return;
      }
      menuMain.ButtonInfos.Clear();
      ArrayList plugins = PluginManager.SetupForms;

      using (Profile.Settings xmlreader = new Profile.MPSettings())
      {
        foreach (ISetupForm setup in plugins)
        {
          string plugInText;
          string focusTexture;
          string nonFocusTexture;
          string hover;
          string nonFocusHover;
          if (setup.GetHome(out plugInText, out focusTexture, out nonFocusTexture, out hover))
          {
            if (setup.PluginName().Equals("Home"))
            {
              continue;
            }
            IShowPlugin showPlugin = setup as IShowPlugin;

            string showInPlugIns = xmlreader.GetValue("myplugins", setup.PluginName());
            if ((showInPlugIns == null) || (showInPlugIns.Length < 1))
            {
              if ((showPlugin != null) && (showPlugin.ShowDefaultHome() == true))
              {
                continue;
              }
            }
            else
            {
              if (showInPlugIns.ToLowerInvariant().Equals("no"))
              {
                continue;
              }
            }

            if ((focusTexture == null) || (focusTexture.Length < 1))
            {
              focusTexture = setup.PluginName();
            }
            if ((nonFocusTexture == null) || (nonFocusTexture.Length < 1))
            {
              nonFocusTexture = setup.PluginName();
            }
            if ((hover == null) || (hover.Length < 1))
            {
              hover = setup.PluginName();
            }
            focusTexture = GetFocusTextureFileName(focusTexture);
            nonFocusTexture = GetNonFocusTextureFileName(nonFocusTexture);
            nonFocusHover = GetNonFocusHoverFileName(hover);
            hover = GetHoverFileName(hover);
            int index = xmlreader.GetValueAsInt("pluginSorting", "my Plugins", Int32.MaxValue);
            menuMain.ButtonInfos.Add(new MenuButtonInfo(plugInText, setup.GetWindowId(), focusTexture, nonFocusTexture,
                                                        hover, nonFocusHover, index));
          }
        }
      }
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:65,代码来源:GUIPlugIns.cs

示例2: LoadButtonNames

    protected override void LoadButtonNames()
    {
      if (menuMain == null)
      {
        return;
      }
      menuMain.ButtonInfos.Clear();
      ArrayList plugins = PluginManager.SetupForms;
      int myPluginsCount = 0;
      using (Profile.Settings xmlreader = new Profile.MPSettings())
      {
        foreach (ISetupForm setup in plugins)
        {
          string plugInText;
          string focusTexture;
          string nonFocusTexture;
          string hover;
          string nonFocusHover;
          if (setup.GetHome(out plugInText, out focusTexture, out nonFocusTexture, out hover))
          {
            if (setup.PluginName().Equals("Home"))
            {
              continue;
            }
            IShowPlugin showPlugin = setup as IShowPlugin;
            if (_useMyPlugins)
            {
              string showInHome = xmlreader.GetValue("home", setup.PluginName());
              if ((showInHome == null) || (showInHome.Length < 1))
              {
                if (showPlugin == null)
                {
                  continue;
                }
                if (showPlugin.ShowDefaultHome() == false)
                {
                  myPluginsCount++;
                  continue;
                }
              }
              else
              {
                if (showInHome.ToLower().Equals("no"))
                {
                  myPluginsCount++;
                  continue;
                }
              }
            }
            int index = xmlreader.GetValueAsInt("pluginSorting", setup.PluginName(), Int32.MaxValue);
            if ((focusTexture == null) || (focusTexture.Length < 1))
            {
              focusTexture = setup.PluginName();
            }
            if ((nonFocusTexture == null) || (nonFocusTexture.Length < 1))
            {
              nonFocusTexture = setup.PluginName();
            }
            if ((hover == null) || (hover.Length < 1))
            {
              hover = setup.PluginName();
            }
            focusTexture = GetFocusTextureFileName(focusTexture);
            nonFocusTexture = GetNonFocusTextureFileName(nonFocusTexture);
            nonFocusHover = GetNonFocusHoverFileName(hover);
            hover = GetHoverFileName(hover);
            menuMain.ButtonInfos.Add(new MenuButtonInfo(plugInText, setup.GetWindowId(), focusTexture, nonFocusTexture,
                                                        hover, nonFocusHover, index));
          }
        }

        if ((_useMyPlugins) && (myPluginsCount > 0))
        {
          string focusTexture = GetFocusTextureFileName("my plugins");
          string nonFocusTexture = GetNonFocusTextureFileName("my plugins");
          string hover = GetHoverFileName("my plugins");
          string nonFocusHover = GetNonFocusHoverFileName("my plugins");
          int index = xmlreader.GetValueAsInt("pluginSorting", "my Plugins", Int32.MaxValue);
          menuMain.ButtonInfos.Add(new MenuButtonInfo(GUILocalizeStrings.Get(913), (int)Window.WINDOW_MYPLUGINS,
                                                      focusTexture, nonFocusTexture, hover, nonFocusHover, index));
        }
      }
    }
开发者ID:nio22,项目名称:MediaPortal-1,代码行数:83,代码来源:GUIHome.cs

示例3: LoadPlugins

    private void LoadPlugins()
    {
      tvMenu.Nodes.Clear();
      string directory = Config.GetSubFolder(Config.Dir.Plugins, "windows");
      if (!Directory.Exists(directory))
      {
        return;
      }

      using (Profile.Settings xmlreader = new Profile.MPSettings())
      {
        TreeNode tnMyPlugIns = null;
        bool useMyPlugins = xmlreader.GetValueAsBool("home", "usemyplugins", true);
        if (useMyPlugins)
        {
          tnMyPlugIns = new TreeNode("my Plugins");
          tnMyPlugIns.Tag = new PluginInfo("my Plugins");
          tvMenu.Nodes.Add(tnMyPlugIns);
        }

        string[] files = Directory.GetFiles(directory, "*.dll");
        foreach (string pluginFile in files)
        {
          try
          {
            Assembly pluginAssembly = Assembly.LoadFrom(pluginFile);

            if (pluginAssembly != null)
            {
              Type[] exportedTypes = pluginAssembly.GetExportedTypes();
              foreach (Type type in exportedTypes)
              {
                // an abstract class cannot be instanciated
                if (type.IsAbstract)
                {
                  continue;
                }
                // Try to locate the interface we're interested in
                if (type.GetInterface("MediaPortal.GUI.Library.ISetupForm") != null)
                {
                  try
                  {
                    // Create instance of the current type
                    object pluginObject = Activator.CreateInstance(type);
                    ISetupForm pluginForm = pluginObject as ISetupForm;

                    if (pluginForm != null)
                    {
                      if (pluginForm.PluginName().Equals("Home"))
                      {
                        continue;
                      }
                      if (pluginForm.PluginName().Equals("my Plugins"))
                      {
                        if (tnMyPlugIns != null)
                        {
                          tnMyPlugIns.Tag = new PluginInfo(pluginForm);
                          tvMenu.Nodes.Add(tnMyPlugIns);
                        }
                        continue;
                      }
                      string enabled = xmlreader.GetValue("plugins", pluginForm.PluginName());
                      if (enabled.CompareTo("yes") != 0)
                      {
                        continue;
                      }

                      string showInHome = xmlreader.GetValue("home", pluginForm.PluginName());

                      TreeNode node;
                      if ((useMyPlugins) && (showInHome.CompareTo("no") == 0))
                      {
                        node = tnMyPlugIns.Nodes.Add(pluginForm.PluginName());
                      }
                      else
                      {
                        node = tvMenu.Nodes.Add(pluginForm.PluginName());
                      }

                      if (node != null)
                      {
                        node.Tag = new PluginInfo(pluginForm);
                      }
                    }
                  }
                  catch (Exception setupFormException)
                  {
                    Log.Info("Exception in plugin SetupForm loading :{0}", setupFormException.Message);
                    Log.Info("Current class is :{0}", type.FullName);
                    Log.Info(setupFormException.StackTrace);
                  }
                }
              }
            }
          }
          catch (Exception unknownException)
          {
            Log.Info("Exception in plugin loading :{0}", unknownException.Message);
            Log.Info(unknownException.StackTrace);
          }
//.........这里部分代码省略.........
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:101,代码来源:GUIHomeSetupForm.cs


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