ConfigurationPageInfo.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using MediaBrowser.Common.Plugins;
  2. using MediaBrowser.Controller.Plugins;
  3. using MediaBrowser.Model.Plugins;
  4. namespace MediaBrowser.WebDashboard.Api
  5. {
  6. public class ConfigurationPageInfo
  7. {
  8. /// <summary>
  9. /// Gets the name.
  10. /// </summary>
  11. /// <value>The name.</value>
  12. public string Name { get; set; }
  13. public bool EnableInMainMenu { get; set; }
  14. public string MenuSection { get; set; }
  15. public string MenuIcon { get; set; }
  16. public string DisplayName { get; set; }
  17. /// <summary>
  18. /// Gets the type of the configuration page.
  19. /// </summary>
  20. /// <value>The type of the configuration page.</value>
  21. public ConfigurationPageType ConfigurationPageType { get; set; }
  22. /// <summary>
  23. /// Gets or sets the plugin id.
  24. /// </summary>
  25. /// <value>The plugin id.</value>
  26. public string PluginId { get; set; }
  27. public ConfigurationPageInfo(IPluginConfigurationPage page)
  28. {
  29. Name = page.Name;
  30. ConfigurationPageType = page.ConfigurationPageType;
  31. if (page.Plugin != null)
  32. {
  33. DisplayName = page.Plugin.Name;
  34. // Don't use "N" because it needs to match Plugin.Id
  35. PluginId = page.Plugin.Id.ToString();
  36. }
  37. }
  38. public ConfigurationPageInfo(IPlugin plugin, PluginPageInfo page)
  39. {
  40. Name = page.Name;
  41. EnableInMainMenu = page.EnableInMainMenu;
  42. MenuSection = page.MenuSection;
  43. MenuIcon = page.MenuIcon;
  44. DisplayName = string.IsNullOrWhiteSpace(page.DisplayName) ? plugin.Name : page.DisplayName;
  45. // Don't use "N" because it needs to match Plugin.Id
  46. PluginId = plugin.Id.ToString();
  47. }
  48. }
  49. }