using System; using System.Collections.Generic; using System.Reflection; using System.Threading.Tasks; namespace MediaBrowser.Common { /// /// Delegate used with GetExports{T}. /// /// Type to create. /// New instance of type type. public delegate object? CreationDelegateFactory(Type type); /// /// An interface to be implemented by the applications hosting a kernel. /// public interface IApplicationHost { /// /// Occurs when [has pending restart changed]. /// event EventHandler? HasPendingRestartChanged; /// /// Gets the name. /// /// The name. string Name { get; } /// /// Gets the device identifier. /// /// The device identifier. string SystemId { get; } /// /// Gets a value indicating whether this instance has pending kernel reload. /// /// true if this instance has pending kernel reload; otherwise, false. bool HasPendingRestart { get; } /// /// Gets a value indicating whether this instance is currently shutting down. /// /// true if this instance is shutting down; otherwise, false. bool IsShuttingDown { get; } /// /// Gets a value indicating whether this instance can self restart. /// /// true if this instance can self restart; otherwise, false. bool CanSelfRestart { get; } /// /// Gets the application version. /// /// The application version. Version ApplicationVersion { get; } /// /// Gets or sets the service provider. /// IServiceProvider? ServiceProvider { get; set; } /// /// Gets the application version. /// /// The application version. string ApplicationVersionString { get; } /// /// Gets the application user agent. /// /// The application user agent. string ApplicationUserAgent { get; } /// /// Gets the email address for use within a comment section of a user agent field. /// Presently used to provide contact information to MusicBrainz service. /// string ApplicationUserAgentAddress { get; } /// /// Gets all plugin assemblies which implement a custom rest api. /// /// An containing the plugin assemblies. IEnumerable GetApiPluginAssemblies(); /// /// Notifies the pending restart. /// void NotifyPendingRestart(); /// /// Restarts this instance. /// void Restart(); /// /// Gets the exports. /// /// The type. /// If set to true [manage lifetime]. /// . IReadOnlyCollection GetExports(bool manageLifetime = true); /// /// Gets the exports. /// /// The type. /// Delegate function that gets called to create the object. /// If set to true [manage lifetime]. /// . IReadOnlyCollection GetExports(CreationDelegateFactory defaultFunc, bool manageLifetime = true); /// /// Gets the export types. /// /// The type. /// IEnumerable{Type}. IEnumerable GetExportTypes(); /// /// Resolves this instance. /// /// The Type. /// ``0. T Resolve(); /// /// Shuts down. /// /// A task. Task Shutdown(); /// /// Initializes this instance. /// void Init(); /// /// Creates the instance. /// /// The type. /// System.Object. object CreateInstance(Type type); } }