using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Common.Plugins; using MediaBrowser.Model.Events; using MediaBrowser.Model.Updates; namespace MediaBrowser.Common.Updates { public interface IInstallationManager : IDisposable { event EventHandler PackageInstalling; event EventHandler PackageInstallationCompleted; event EventHandler PackageInstallationFailed; event EventHandler PackageInstallationCancelled; /// /// The completed installations /// IEnumerable CompletedInstallations { get; } /// /// Occurs when [plugin uninstalled]. /// event EventHandler> PluginUninstalled; /// /// Occurs when [plugin updated]. /// event EventHandler> PluginUpdated; /// /// Occurs when [plugin updated]. /// event EventHandler> PluginInstalled; /// /// Gets all available packages. /// /// The cancellation token. /// if set to true [with registration]. /// Type of the package. /// The application version. /// Task{List{PackageInfo}}. Task> GetAvailablePackages(CancellationToken cancellationToken, bool withRegistration = true, string packageType = null, Version applicationVersion = null); /// /// Gets all available packages from a static resource. /// /// The cancellation token. /// Task{List{PackageInfo}}. Task> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken); /// /// Gets the package. /// /// The name. /// The assembly guid /// The classification. /// The version. /// Task{PackageVersionInfo}. Task GetPackage(string name, string guid, PackageVersionClass classification, Version version); /// /// Gets the latest compatible version. /// /// The name. /// The assembly guid /// The current server version. /// The classification. /// Task{PackageVersionInfo}. Task GetLatestCompatibleVersion(string name, string guid, Version currentServerVersion, PackageVersionClass classification = PackageVersionClass.Release); /// /// Gets the latest compatible version. /// /// The available packages. /// The name. /// The assembly guid /// The current server version. /// The classification. /// PackageVersionInfo. PackageVersionInfo GetLatestCompatibleVersion(IEnumerable availablePackages, string name, string guid, Version currentServerVersion, PackageVersionClass classification = PackageVersionClass.Release); /// /// Gets the available plugin updates. /// /// The current server version. /// if set to true [with auto update enabled]. /// The cancellation token. /// Task{IEnumerable{PackageVersionInfo}}. Task> GetAvailablePluginUpdates(Version applicationVersion, bool withAutoUpdateEnabled, CancellationToken cancellationToken); /// /// Installs the package. /// /// The package. /// if set to true [is plugin]. /// The progress. /// The cancellation token. /// Task. /// package Task InstallPackage(PackageVersionInfo package, IProgress progress, CancellationToken cancellationToken); /// /// Uninstalls a plugin /// /// The plugin. /// void UninstallPlugin(IPlugin plugin); /// /// Cancels the installation /// /// The id of the package that is being installed /// Returns true if the install was cancelled bool CancelInstallation(Guid id); } }