IApplicationHost.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Threading.Tasks;
  4. using MediaBrowser.Common.Plugins;
  5. using MediaBrowser.Model.Events;
  6. using MediaBrowser.Model.Updates;
  7. using Microsoft.Extensions.DependencyInjection;
  8. namespace MediaBrowser.Common
  9. {
  10. /// <summary>
  11. /// An interface to be implemented by the applications hosting a kernel
  12. /// </summary>
  13. public interface IApplicationHost
  14. {
  15. /// <summary>
  16. /// Gets the name.
  17. /// </summary>
  18. /// <value>The name.</value>
  19. string Name { get; }
  20. /// <summary>
  21. /// Gets the device identifier.
  22. /// </summary>
  23. /// <value>The device identifier.</value>
  24. string SystemId { get; }
  25. /// <summary>
  26. /// Occurs when [application updated].
  27. /// </summary>
  28. event EventHandler<GenericEventArgs<PackageVersionInfo>> ApplicationUpdated;
  29. /// <summary>
  30. /// Gets or sets a value indicating whether this instance has pending kernel reload.
  31. /// </summary>
  32. /// <value><c>true</c> if this instance has pending kernel reload; otherwise, <c>false</c>.</value>
  33. bool HasPendingRestart { get; }
  34. bool IsShuttingDown { get; }
  35. /// <summary>
  36. /// Gets a value indicating whether this instance can self restart.
  37. /// </summary>
  38. /// <value><c>true</c> if this instance can self restart; otherwise, <c>false</c>.</value>
  39. bool CanSelfRestart { get; }
  40. /// <summary>
  41. /// Occurs when [has pending restart changed].
  42. /// </summary>
  43. event EventHandler HasPendingRestartChanged;
  44. /// <summary>
  45. /// Notifies the pending restart.
  46. /// </summary>
  47. void NotifyPendingRestart();
  48. /// <summary>
  49. /// Restarts this instance.
  50. /// </summary>
  51. void Restart();
  52. /// <summary>
  53. /// Gets the application version.
  54. /// </summary>
  55. /// <value>The application version.</value>
  56. string ApplicationVersion { get; }
  57. /// <summary>
  58. /// Gets the application user agent.
  59. /// </summary>
  60. /// <value>The application user agent.</value>
  61. string ApplicationUserAgent { get; }
  62. /// <summary>
  63. /// Gets the email address for use within a comment section of a user agent field.
  64. /// Presently used to provide contact information to MusicBrainz service.
  65. /// </summary>
  66. string ApplicationUserAgentAddress { get; }
  67. /// <summary>
  68. /// Gets the exports.
  69. /// </summary>
  70. /// <typeparam name="T"></typeparam>
  71. /// <param name="manageLiftime">if set to <c>true</c> [manage liftime].</param>
  72. /// <returns>IEnumerable{``0}.</returns>
  73. IEnumerable<T> GetExports<T>(bool manageLifetime = true);
  74. /// <summary>
  75. /// Resolves this instance.
  76. /// </summary>
  77. /// <typeparam name="T"></typeparam>
  78. /// <returns>``0.</returns>
  79. T Resolve<T>();
  80. /// <summary>
  81. /// Shuts down.
  82. /// </summary>
  83. Task Shutdown();
  84. /// <summary>
  85. /// Gets the plugins.
  86. /// </summary>
  87. /// <value>The plugins.</value>
  88. IPlugin[] Plugins { get; }
  89. /// <summary>
  90. /// Removes the plugin.
  91. /// </summary>
  92. /// <param name="plugin">The plugin.</param>
  93. void RemovePlugin(IPlugin plugin);
  94. /// <summary>
  95. /// Inits this instance.
  96. /// </summary>
  97. Task InitAsync(IServiceCollection serviceCollection);
  98. /// <summary>
  99. /// Creates the instance.
  100. /// </summary>
  101. /// <param name="type">The type.</param>
  102. /// <returns>System.Object.</returns>
  103. object CreateInstance(Type type);
  104. PackageVersionClass SystemUpdateLevel { get; }
  105. }
  106. }