ConfigurationPageInfo.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System;
  2. using MediaBrowser.Common.Plugins;
  3. using MediaBrowser.Controller.Plugins;
  4. using MediaBrowser.Model.Plugins;
  5. namespace Jellyfin.Api.Models
  6. {
  7. /// <summary>
  8. /// The configuration page info.
  9. /// </summary>
  10. public class ConfigurationPageInfo
  11. {
  12. /// <summary>
  13. /// Initializes a new instance of the <see cref="ConfigurationPageInfo"/> class.
  14. /// </summary>
  15. /// <param name="page">Instance of <see cref="IPluginConfigurationPage"/> interface.</param>
  16. public ConfigurationPageInfo(IPluginConfigurationPage page)
  17. {
  18. Name = page.Name;
  19. ConfigurationPageType = page.ConfigurationPageType;
  20. if (page.Plugin != null)
  21. {
  22. DisplayName = page.Plugin.Name;
  23. // Don't use "N" because it needs to match Plugin.Id
  24. PluginId = page.Plugin.Id;
  25. }
  26. }
  27. /// <summary>
  28. /// Initializes a new instance of the <see cref="ConfigurationPageInfo"/> class.
  29. /// </summary>
  30. /// <param name="plugin">Instance of <see cref="IPlugin"/> interface.</param>
  31. /// <param name="page">Instance of <see cref="PluginPageInfo"/> interface.</param>
  32. public ConfigurationPageInfo(IPlugin? plugin, PluginPageInfo page)
  33. {
  34. Name = page.Name;
  35. EnableInMainMenu = page.EnableInMainMenu;
  36. MenuSection = page.MenuSection;
  37. MenuIcon = page.MenuIcon;
  38. DisplayName = string.IsNullOrWhiteSpace(page.DisplayName) ? plugin?.Name : page.DisplayName;
  39. PluginId = plugin?.Id;
  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 Guid? PluginId { get; set; }
  72. }
  73. }