IPlugin.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. using MediaBrowser.Common.Kernel;
  2. using MediaBrowser.Model.Logging;
  3. using MediaBrowser.Model.Plugins;
  4. using System;
  5. namespace MediaBrowser.Common.Plugins
  6. {
  7. public interface IPlugin
  8. {
  9. /// <summary>
  10. /// Gets the name of the plugin
  11. /// </summary>
  12. /// <value>The name.</value>
  13. string Name { get; }
  14. /// <summary>
  15. /// Gets the description.
  16. /// </summary>
  17. /// <value>The description.</value>
  18. string Description { get; }
  19. /// <summary>
  20. /// Gets a value indicating whether this instance is a core plugin.
  21. /// </summary>
  22. /// <value><c>true</c> if this instance is a core plugin; otherwise, <c>false</c>.</value>
  23. bool IsCorePlugin { get; }
  24. /// <summary>
  25. /// Gets the type of configuration this plugin uses
  26. /// </summary>
  27. /// <value>The type of the configuration.</value>
  28. Type ConfigurationType { get; }
  29. /// <summary>
  30. /// Gets the unique id.
  31. /// </summary>
  32. /// <value>The unique id.</value>
  33. Guid Id { get; }
  34. /// <summary>
  35. /// Gets the plugin version
  36. /// </summary>
  37. /// <value>The version.</value>
  38. Version Version { get; }
  39. /// <summary>
  40. /// Gets the name the assembly file
  41. /// </summary>
  42. /// <value>The name of the assembly file.</value>
  43. string AssemblyFileName { get; }
  44. /// <summary>
  45. /// Gets the last date modified of the configuration
  46. /// </summary>
  47. /// <value>The configuration date last modified.</value>
  48. DateTime ConfigurationDateLastModified { get; }
  49. /// <summary>
  50. /// Gets the last date modified of the plugin
  51. /// </summary>
  52. /// <value>The assembly date last modified.</value>
  53. DateTime AssemblyDateLastModified { get; }
  54. /// <summary>
  55. /// Gets the path to the assembly file
  56. /// </summary>
  57. /// <value>The assembly file path.</value>
  58. string AssemblyFilePath { get; }
  59. /// <summary>
  60. /// Gets the plugin's configuration
  61. /// </summary>
  62. /// <value>The configuration.</value>
  63. BasePluginConfiguration Configuration { get; }
  64. /// <summary>
  65. /// Gets the name of the configuration file. Subclasses should override
  66. /// </summary>
  67. /// <value>The name of the configuration file.</value>
  68. string ConfigurationFileName { get; }
  69. /// <summary>
  70. /// Gets the full path to the configuration file
  71. /// </summary>
  72. /// <value>The configuration file path.</value>
  73. string ConfigurationFilePath { get; }
  74. /// <summary>
  75. /// Gets the full path to the data folder, where the plugin can store any miscellaneous files needed
  76. /// </summary>
  77. /// <value>The data folder path.</value>
  78. string DataFolderPath { get; }
  79. /// <summary>
  80. /// Returns true or false indicating if the plugin should be downloaded and run within the Ui.
  81. /// </summary>
  82. /// <value><c>true</c> if [download to UI]; otherwise, <c>false</c>.</value>
  83. bool DownloadToUi { get; }
  84. /// <summary>
  85. /// Gets the logger.
  86. /// </summary>
  87. /// <value>The logger.</value>
  88. ILogger Logger { get; }
  89. /// <summary>
  90. /// Starts the plugin.
  91. /// </summary>
  92. /// <param name="kernel">The kernel.</param>
  93. /// <param name="logger">The logger.</param>
  94. /// <exception cref="System.ArgumentNullException">kernel</exception>
  95. void Initialize(IKernel kernel, ILogger logger);
  96. /// <summary>
  97. /// Disposes the plugins. Undos all actions performed during Init.
  98. /// </summary>
  99. void Dispose();
  100. /// <summary>
  101. /// Saves the current configuration to the file system
  102. /// </summary>
  103. /// <exception cref="System.InvalidOperationException">Cannot call Plugin.SaveConfiguration from the UI.</exception>
  104. void SaveConfiguration();
  105. /// <summary>
  106. /// Completely overwrites the current configuration with a new copy
  107. /// Returns true or false indicating success or failure
  108. /// </summary>
  109. /// <param name="configuration">The configuration.</param>
  110. /// <exception cref="System.ArgumentNullException">configuration</exception>
  111. void UpdateConfiguration(BasePluginConfiguration configuration);
  112. /// <summary>
  113. /// Gets the plugin info.
  114. /// </summary>
  115. /// <returns>PluginInfo.</returns>
  116. PluginInfo GetPluginInfo();
  117. /// <summary>
  118. /// Called when just before the plugin is uninstalled from the server.
  119. /// </summary>
  120. void OnUninstalling();
  121. }
  122. }