ConfigurationPageInfo.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 DisplayName { get; set; }
  15. /// <summary>
  16. /// Gets the type of the configuration page.
  17. /// </summary>
  18. /// <value>The type of the configuration page.</value>
  19. public ConfigurationPageType ConfigurationPageType { get; set; }
  20. /// <summary>
  21. /// Gets or sets the plugin id.
  22. /// </summary>
  23. /// <value>The plugin id.</value>
  24. public string PluginId { get; set; }
  25. public ConfigurationPageInfo(IPluginConfigurationPage page)
  26. {
  27. Name = page.Name;
  28. ConfigurationPageType = page.ConfigurationPageType;
  29. if (page.Plugin != null)
  30. {
  31. DisplayName = page.Plugin.Name;
  32. // Don't use "N" because it needs to match Plugin.Id
  33. PluginId = page.Plugin.Id.ToString();
  34. }
  35. }
  36. public ConfigurationPageInfo(IPlugin plugin, PluginPageInfo page)
  37. {
  38. Name = page.Name;
  39. EnableInMainMenu = page.EnableInMainMenu;
  40. DisplayName = string.IsNullOrWhiteSpace(page.DisplayName) ? plugin.Name : page.DisplayName;
  41. // Don't use "N" because it needs to match Plugin.Id
  42. PluginId = plugin.Id.ToString();
  43. }
  44. }
  45. }