IPlugin.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using MediaBrowser.Model.Plugins;
  2. using System;
  3. namespace MediaBrowser.Common.Plugins
  4. {
  5. /// <summary>
  6. /// Interface IPlugin
  7. /// </summary>
  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 the type of configuration this plugin uses
  22. /// </summary>
  23. /// <value>The type of the configuration.</value>
  24. Type ConfigurationType { get; }
  25. /// <summary>
  26. /// Gets the unique id.
  27. /// </summary>
  28. /// <value>The unique id.</value>
  29. Guid Id { get; }
  30. /// <summary>
  31. /// Gets the plugin version
  32. /// </summary>
  33. /// <value>The version.</value>
  34. Version Version { get; }
  35. /// <summary>
  36. /// Gets a value indicating whether this instance is first run.
  37. /// </summary>
  38. /// <value><c>true</c> if this instance is first run; otherwise, <c>false</c>.</value>
  39. bool IsFirstRun { get; }
  40. /// <summary>
  41. /// Gets the last date modified of the configuration
  42. /// </summary>
  43. /// <value>The configuration date last modified.</value>
  44. DateTime ConfigurationDateLastModified { get; }
  45. /// <summary>
  46. /// Gets the path to the assembly file
  47. /// </summary>
  48. /// <value>The assembly file path.</value>
  49. string AssemblyFilePath { get; }
  50. /// <summary>
  51. /// Gets the plugin's configuration
  52. /// </summary>
  53. /// <value>The configuration.</value>
  54. BasePluginConfiguration Configuration { get; }
  55. /// <summary>
  56. /// Gets the name of the configuration file. Subclasses should override
  57. /// </summary>
  58. /// <value>The name of the configuration file.</value>
  59. string ConfigurationFileName { get; }
  60. /// <summary>
  61. /// Gets the full path to the configuration file
  62. /// </summary>
  63. /// <value>The configuration file path.</value>
  64. string ConfigurationFilePath { get; }
  65. /// <summary>
  66. /// Gets the full path to the data folder, where the plugin can store any miscellaneous files needed
  67. /// </summary>
  68. /// <value>The data folder path.</value>
  69. string DataFolderPath { get; }
  70. /// <summary>
  71. /// Saves the current configuration to the file system
  72. /// </summary>
  73. /// <exception cref="System.InvalidOperationException">Cannot call Plugin.SaveConfiguration from the UI.</exception>
  74. void SaveConfiguration();
  75. /// <summary>
  76. /// Completely overwrites the current configuration with a new copy
  77. /// Returns true or false indicating success or failure
  78. /// </summary>
  79. /// <param name="configuration">The configuration.</param>
  80. /// <exception cref="System.ArgumentNullException">configuration</exception>
  81. void UpdateConfiguration(BasePluginConfiguration configuration);
  82. /// <summary>
  83. /// Gets the plugin info.
  84. /// </summary>
  85. /// <returns>PluginInfo.</returns>
  86. PluginInfo GetPluginInfo();
  87. /// <summary>
  88. /// Called when just before the plugin is uninstalled from the server.
  89. /// </summary>
  90. void OnUninstalling();
  91. void SetStartupInfo(bool isFirstRun, Func<string, DateTime> dateModifiedFn, Action<string> directoryCreateFn);
  92. }
  93. }