IApplicationHost.cs 4.2 KB

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