ConfigurationPageInfo.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. PluginId = page.Plugin.Id;
  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. PluginId = plugin?.Id;
  39. }
  40. /// <summary>
  41. /// Gets or sets the name.
  42. /// </summary>
  43. /// <value>The name.</value>
  44. public string Name { get; set; }
  45. /// <summary>
  46. /// Gets or sets a value indicating whether the configurations page is enabled in the main menu.
  47. /// </summary>
  48. public bool EnableInMainMenu { get; set; }
  49. /// <summary>
  50. /// Gets or sets the menu section.
  51. /// </summary>
  52. public string? MenuSection { get; set; }
  53. /// <summary>
  54. /// Gets or sets the menu icon.
  55. /// </summary>
  56. public string? MenuIcon { get; set; }
  57. /// <summary>
  58. /// Gets or sets the display name.
  59. /// </summary>
  60. public string? DisplayName { get; set; }
  61. /// <summary>
  62. /// Gets or sets the type of the configuration page.
  63. /// </summary>
  64. /// <value>The type of the configuration page.</value>
  65. public ConfigurationPageType ConfigurationPageType { get; set; }
  66. /// <summary>
  67. /// Gets or sets the plugin id.
  68. /// </summary>
  69. /// <value>The plugin id.</value>
  70. public Guid? PluginId { get; set; }
  71. }
  72. }