ConfigurationPageInfo.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using MediaBrowser.Common.Plugins;
  2. using MediaBrowser.Controller.Plugins;
  3. using MediaBrowser.Model.Plugins;
  4. namespace Jellyfin.Api.Models
  5. {
  6. /// <summary>
  7. /// The configuration page info.
  8. /// </summary>
  9. public class ConfigurationPageInfo
  10. {
  11. /// <summary>
  12. /// Initializes a new instance of the <see cref="ConfigurationPageInfo"/> class.
  13. /// </summary>
  14. /// <param name="page">Instance of <see cref="IPluginConfigurationPage"/> interface.</param>
  15. public ConfigurationPageInfo(IPluginConfigurationPage page)
  16. {
  17. Name = page.Name;
  18. ConfigurationPageType = page.ConfigurationPageType;
  19. if (page.Plugin != null)
  20. {
  21. DisplayName = page.Plugin.Name;
  22. // Don't use "N" because it needs to match Plugin.Id
  23. PluginId = page.Plugin.Id.ToString();
  24. }
  25. }
  26. /// <summary>
  27. /// Initializes a new instance of the <see cref="ConfigurationPageInfo"/> class.
  28. /// </summary>
  29. /// <param name="plugin">Instance of <see cref="IPlugin"/> interface.</param>
  30. /// <param name="page">Instance of <see cref="PluginPageInfo"/> interface.</param>
  31. public ConfigurationPageInfo(IPlugin plugin, PluginPageInfo page)
  32. {
  33. Name = page.Name;
  34. EnableInMainMenu = page.EnableInMainMenu;
  35. MenuSection = page.MenuSection;
  36. MenuIcon = page.MenuIcon;
  37. DisplayName = string.IsNullOrWhiteSpace(page.DisplayName) ? plugin.Name : page.DisplayName;
  38. // Don't use "N" because it needs to match Plugin.Id
  39. PluginId = plugin.Id.ToString();
  40. }
  41. /// <summary>
  42. /// Gets or sets the name.
  43. /// </summary>
  44. /// <value>The name.</value>
  45. public string Name { get; set; }
  46. /// <summary>
  47. /// Gets or sets a value indicating whether the configurations page is enabled in the main menu.
  48. /// </summary>
  49. public bool EnableInMainMenu { get; set; }
  50. /// <summary>
  51. /// Gets or sets the menu section.
  52. /// </summary>
  53. public string? MenuSection { get; set; }
  54. /// <summary>
  55. /// Gets or sets the menu icon.
  56. /// </summary>
  57. public string? MenuIcon { get; set; }
  58. /// <summary>
  59. /// Gets or sets the display name.
  60. /// </summary>
  61. public string? DisplayName { get; set; }
  62. /// <summary>
  63. /// Gets or sets the type of the configuration page.
  64. /// </summary>
  65. /// <value>The type of the configuration page.</value>
  66. public ConfigurationPageType ConfigurationPageType { get; set; }
  67. /// <summary>
  68. /// Gets or sets the plugin id.
  69. /// </summary>
  70. /// <value>The plugin id.</value>
  71. public string? PluginId { get; set; }
  72. }
  73. }