IPlugin.cs 4.9 KB

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