IPlugin.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #pragma warning disable CS1591
  2. using System;
  3. using MediaBrowser.Model.Plugins;
  4. using Microsoft.Extensions.DependencyInjection;
  5. namespace MediaBrowser.Common.Plugins
  6. {
  7. /// <summary>
  8. /// Interface IPlugin.
  9. /// </summary>
  10. public interface IPlugin
  11. {
  12. /// <summary>
  13. /// Gets the name of the plugin.
  14. /// </summary>
  15. /// <value>The name.</value>
  16. string Name { get; }
  17. /// <summary>
  18. /// Gets the description.
  19. /// </summary>
  20. /// <value>The description.</value>
  21. string Description { get; }
  22. /// <summary>
  23. /// Gets the unique id.
  24. /// </summary>
  25. /// <value>The unique id.</value>
  26. Guid Id { get; }
  27. /// <summary>
  28. /// Gets the plugin version.
  29. /// </summary>
  30. /// <value>The version.</value>
  31. Version Version { get; }
  32. /// <summary>
  33. /// Gets the path to the assembly file.
  34. /// </summary>
  35. /// <value>The assembly file path.</value>
  36. string AssemblyFilePath { get; }
  37. /// <summary>
  38. /// Gets a value indicating whether the plugin can be uninstalled.
  39. /// </summary>
  40. bool CanUninstall { get; }
  41. /// <summary>
  42. /// Gets the full path to the data folder, where the plugin can store any miscellaneous files needed.
  43. /// </summary>
  44. /// <value>The data folder path.</value>
  45. string DataFolderPath { get; }
  46. /// <summary>
  47. /// Gets the plugin info.
  48. /// </summary>
  49. /// <returns>PluginInfo.</returns>
  50. PluginInfo GetPluginInfo();
  51. /// <summary>
  52. /// Called when just before the plugin is uninstalled from the server.
  53. /// </summary>
  54. void OnUninstalling();
  55. /// <summary>
  56. /// Registers the plugin's services to the service collection.
  57. /// </summary>
  58. /// <param name="serviceCollection">The service collection.</param>
  59. void RegisterServices(IServiceCollection serviceCollection);
  60. /// <summary>
  61. /// Unregisters the plugin's services from the service collection.
  62. /// </summary>
  63. /// <param name="serviceCollection">The service collection.</param>
  64. void UnregisterServices(IServiceCollection serviceCollection);
  65. }
  66. public interface IHasPluginConfiguration
  67. {
  68. /// <summary>
  69. /// Gets the type of configuration this plugin uses.
  70. /// </summary>
  71. /// <value>The type of the configuration.</value>
  72. Type ConfigurationType { get; }
  73. /// <summary>
  74. /// Gets the plugin's configuration.
  75. /// </summary>
  76. /// <value>The configuration.</value>
  77. BasePluginConfiguration Configuration { get; }
  78. /// <summary>
  79. /// Completely overwrites the current configuration with a new copy
  80. /// Returns true or false indicating success or failure.
  81. /// </summary>
  82. /// <param name="configuration">The configuration.</param>
  83. /// <exception cref="ArgumentNullException"><c>configuration</c> is <c>null</c>.</exception>
  84. void UpdateConfiguration(BasePluginConfiguration configuration);
  85. void SetStartupInfo(Action<string> directoryCreateFn);
  86. }
  87. }