2019-01-13 20:01:16 +00:00
|
|
|
using System;
|
2018-12-27 23:27:57 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Threading.Tasks;
|
2019-01-13 19:25:11 +00:00
|
|
|
using MediaBrowser.Common.Plugins;
|
|
|
|
using MediaBrowser.Model.Updates;
|
2020-02-28 22:28:15 +00:00
|
|
|
using Microsoft.Extensions.Configuration;
|
2019-02-03 16:09:12 +00:00
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
namespace MediaBrowser.Common
|
|
|
|
{
|
|
|
|
/// <summary>
|
2019-12-10 23:13:57 +00:00
|
|
|
/// An interface to be implemented by the applications hosting a kernel.
|
2018-12-27 23:27:57 +00:00
|
|
|
/// </summary>
|
|
|
|
public interface IApplicationHost
|
|
|
|
{
|
2019-12-10 23:13:57 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Occurs when [has pending restart changed].
|
|
|
|
/// </summary>
|
|
|
|
event EventHandler HasPendingRestartChanged;
|
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the name.
|
|
|
|
/// </summary>
|
|
|
|
/// <value>The name.</value>
|
|
|
|
string Name { get; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the device identifier.
|
|
|
|
/// </summary>
|
|
|
|
/// <value>The device identifier.</value>
|
|
|
|
string SystemId { get; }
|
|
|
|
|
|
|
|
/// <summary>
|
2019-12-10 23:13:57 +00:00
|
|
|
/// Gets a value indicating whether this instance has pending kernel reload.
|
2018-12-27 23:27:57 +00:00
|
|
|
/// </summary>
|
|
|
|
/// <value><c>true</c> if this instance has pending kernel reload; otherwise, <c>false</c>.</value>
|
|
|
|
bool HasPendingRestart { get; }
|
|
|
|
|
2019-10-09 15:10:16 +00:00
|
|
|
/// <summary>
|
2019-12-10 23:13:57 +00:00
|
|
|
/// Gets a value indicating whether this instance is currently shutting down.
|
2019-10-09 15:10:16 +00:00
|
|
|
/// </summary>
|
|
|
|
/// <value><c>true</c> if this instance is shutting down; otherwise, <c>false</c>.</value>
|
2018-12-27 23:27:57 +00:00
|
|
|
bool IsShuttingDown { get; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a value indicating whether this instance can self restart.
|
|
|
|
/// </summary>
|
|
|
|
/// <value><c>true</c> if this instance can self restart; otherwise, <c>false</c>.</value>
|
|
|
|
bool CanSelfRestart { get; }
|
|
|
|
|
2019-01-20 00:12:44 +00:00
|
|
|
/// <summary>
|
2019-01-20 02:35:33 +00:00
|
|
|
/// Gets the application version.
|
2019-01-20 00:12:44 +00:00
|
|
|
/// </summary>
|
2019-01-20 02:35:33 +00:00
|
|
|
/// <value>The application version.</value>
|
2019-10-08 18:51:11 +00:00
|
|
|
Version ApplicationVersion { get; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the application version.
|
|
|
|
/// </summary>
|
|
|
|
/// <value>The application version.</value>
|
|
|
|
string ApplicationVersionString { get; }
|
2019-01-20 00:12:44 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the application user agent.
|
|
|
|
/// </summary>
|
|
|
|
/// <value>The application user agent.</value>
|
|
|
|
string ApplicationUserAgent { get; }
|
|
|
|
|
2019-03-14 21:32:27 +00:00
|
|
|
/// <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; }
|
|
|
|
|
2019-12-10 23:13:57 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the plugins.
|
|
|
|
/// </summary>
|
|
|
|
/// <value>The plugins.</value>
|
|
|
|
IReadOnlyList<IPlugin> Plugins { get; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Notifies the pending restart.
|
|
|
|
/// </summary>
|
|
|
|
void NotifyPendingRestart();
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Restarts this instance.
|
|
|
|
/// </summary>
|
|
|
|
void Restart();
|
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the exports.
|
|
|
|
/// </summary>
|
2019-08-11 14:52:37 +00:00
|
|
|
/// <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);
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Resolves this instance.
|
|
|
|
/// </summary>
|
2019-12-10 23:13:57 +00:00
|
|
|
/// <typeparam name="T">The <c>Type</c>.</typeparam>
|
2018-12-27 23:27:57 +00:00
|
|
|
/// <returns>``0.</returns>
|
|
|
|
T Resolve<T>();
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Shuts down.
|
|
|
|
/// </summary>
|
2019-12-10 23:13:57 +00:00
|
|
|
/// <returns>A task.</returns>
|
2018-12-27 23:27:57 +00:00
|
|
|
Task Shutdown();
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Removes the plugin.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="plugin">The plugin.</param>
|
|
|
|
void RemovePlugin(IPlugin plugin);
|
|
|
|
|
|
|
|
/// <summary>
|
2020-02-28 22:28:15 +00:00
|
|
|
/// Initializes this instance.
|
2018-12-27 23:27:57 +00:00
|
|
|
/// </summary>
|
2019-12-10 23:13:57 +00:00
|
|
|
/// <param name="serviceCollection">The service collection.</param>
|
2020-02-28 22:28:15 +00:00
|
|
|
/// <param name="startupConfig">The configuration to use for initialization.</param>
|
2019-12-10 23:13:57 +00:00
|
|
|
/// <returns>A task.</returns>
|
2020-02-28 22:28:15 +00:00
|
|
|
Task InitAsync(IServiceCollection serviceCollection, IConfiguration startupConfig);
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Creates the instance.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="type">The type.</param>
|
|
|
|
/// <returns>System.Object.</returns>
|
|
|
|
object CreateInstance(Type type);
|
|
|
|
}
|
|
|
|
}
|