diff options
Diffstat (limited to 'MediaBrowser.Common/IApplicationHost.cs')
| -rw-r--r-- | MediaBrowser.Common/IApplicationHost.cs | 112 |
1 files changed, 70 insertions, 42 deletions
diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs index 3a4098612..192a77611 100644 --- a/MediaBrowser.Common/IApplicationHost.cs +++ b/MediaBrowser.Common/IApplicationHost.cs @@ -1,20 +1,28 @@ using System; using System.Collections.Generic; -using System.Threading; +using System.Reflection; using System.Threading.Tasks; -using MediaBrowser.Common.Plugins; -using MediaBrowser.Model.Events; -using MediaBrowser.Model.Updates; -using Microsoft.Extensions.DependencyInjection; namespace MediaBrowser.Common { /// <summary> - /// An interface to be implemented by the applications hosting a kernel + /// Delegate used with GetExports{T}. + /// </summary> + /// <param name="type">Type to create.</param> + /// <returns>New instance of type <param>type</param>.</returns> + public delegate object? CreationDelegateFactory(Type type); + + /// <summary> + /// An interface to be implemented by the applications hosting a kernel. /// </summary> public interface IApplicationHost { /// <summary> + /// Occurs when [has pending restart changed]. + /// </summary> + event EventHandler? HasPendingRestartChanged; + + /// <summary> /// Gets the name. /// </summary> /// <value>The name.</value> @@ -27,16 +35,15 @@ namespace MediaBrowser.Common string SystemId { get; } /// <summary> - /// Occurs when [application updated]. - /// </summary> - event EventHandler<GenericEventArgs<PackageVersionInfo>> ApplicationUpdated; - - /// <summary> - /// Gets or sets a value indicating whether this instance has pending kernel reload. + /// Gets a value indicating whether this instance has pending kernel reload. /// </summary> /// <value><c>true</c> if this instance has pending kernel reload; otherwise, <c>false</c>.</value> bool HasPendingRestart { get; } + /// <summary> + /// Gets a value indicating whether this instance is currently shutting down. + /// </summary> + /// <value><c>true</c> if this instance is shutting down; otherwise, <c>false</c>.</value> bool IsShuttingDown { get; } /// <summary> @@ -46,25 +53,21 @@ namespace MediaBrowser.Common bool CanSelfRestart { get; } /// <summary> - /// Occurs when [has pending restart changed]. - /// </summary> - event EventHandler HasPendingRestartChanged; - - /// <summary> - /// Notifies the pending restart. + /// Gets the application version. /// </summary> - void NotifyPendingRestart(); + /// <value>The application version.</value> + Version ApplicationVersion { get; } /// <summary> - /// Restarts this instance. + /// Gets or sets the service provider. /// </summary> - void Restart(); + IServiceProvider? ServiceProvider { get; set; } /// <summary> /// Gets the application version. /// </summary> /// <value>The application version.</value> - string ApplicationVersion { get; } + string ApplicationVersionString { get; } /// <summary> /// Gets the application user agent. @@ -73,41 +76,68 @@ namespace MediaBrowser.Common string ApplicationUserAgent { get; } /// <summary> + /// Gets the email address for use within a comment section of a user agent field. + /// Presently used to provide contact information to MusicBrainz service. + /// </summary> + string ApplicationUserAgentAddress { get; } + + /// <summary> + /// Gets all plugin assemblies which implement a custom rest api. + /// </summary> + /// <returns>An <see cref="IEnumerable{Assembly}"/> containing the plugin assemblies.</returns> + IEnumerable<Assembly> GetApiPluginAssemblies(); + + /// <summary> + /// Notifies the pending restart. + /// </summary> + void NotifyPendingRestart(); + + /// <summary> + /// Restarts this instance. + /// </summary> + void Restart(); + + /// <summary> /// Gets the exports. /// </summary> - /// <typeparam name="T"></typeparam> - /// <param name="manageLiftime">if set to <c>true</c> [manage liftime].</param> - /// <returns>IEnumerable{``0}.</returns> - IEnumerable<T> GetExports<T>(bool manageLifetime = true); + /// <typeparam name="T">The type.</typeparam> + /// <param name="manageLifetime">If set to <c>true</c> [manage lifetime].</param> + /// <returns><see cref="IReadOnlyCollection{T}" />.</returns> + IReadOnlyCollection<T> GetExports<T>(bool manageLifetime = true); /// <summary> - /// Resolves this instance. + /// Gets the exports. /// </summary> - /// <typeparam name="T"></typeparam> - /// <returns>``0.</returns> - T Resolve<T>(); + /// <typeparam name="T">The type.</typeparam> + /// <param name="defaultFunc">Delegate function that gets called to create the object.</param> + /// <param name="manageLifetime">If set to <c>true</c> [manage lifetime].</param> + /// <returns><see cref="IReadOnlyCollection{T}" />.</returns> + IReadOnlyCollection<T> GetExports<T>(CreationDelegateFactory defaultFunc, bool manageLifetime = true); /// <summary> - /// Shuts down. + /// Gets the export types. /// </summary> - Task Shutdown(); + /// <typeparam name="T">The type.</typeparam> + /// <returns>IEnumerable{Type}.</returns> + IEnumerable<Type> GetExportTypes<T>(); /// <summary> - /// Gets the plugins. + /// Resolves this instance. /// </summary> - /// <value>The plugins.</value> - IPlugin[] Plugins { get; } + /// <typeparam name="T">The <c>Type</c>.</typeparam> + /// <returns>``0.</returns> + T Resolve<T>(); /// <summary> - /// Removes the plugin. + /// Shuts down. /// </summary> - /// <param name="plugin">The plugin.</param> - void RemovePlugin(IPlugin plugin); + /// <returns>A task.</returns> + Task Shutdown(); /// <summary> - /// Inits this instance. + /// Initializes this instance. /// </summary> - Task Init(IServiceCollection serviceCollection); + void Init(); /// <summary> /// Creates the instance. @@ -115,7 +145,5 @@ namespace MediaBrowser.Common /// <param name="type">The type.</param> /// <returns>System.Object.</returns> object CreateInstance(Type type); - - PackageVersionClass SystemUpdateLevel { get; } } } |
