IPlugin.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. }
  56. public interface IHasPluginConfiguration
  57. {
  58. /// <summary>
  59. /// Gets the type of configuration this plugin uses.
  60. /// </summary>
  61. /// <value>The type of the configuration.</value>
  62. Type ConfigurationType { get; }
  63. /// <summary>
  64. /// Gets the plugin's configuration.
  65. /// </summary>
  66. /// <value>The configuration.</value>
  67. BasePluginConfiguration Configuration { get; }
  68. /// <summary>
  69. /// Completely overwrites the current configuration with a new copy
  70. /// Returns true or false indicating success or failure.
  71. /// </summary>
  72. /// <param name="configuration">The configuration.</param>
  73. /// <exception cref="ArgumentNullException"><c>configuration</c> is <c>null</c>.</exception>
  74. void UpdateConfiguration(BasePluginConfiguration configuration);
  75. void SetStartupInfo(Action<string> directoryCreateFn);
  76. }
  77. }