2019-10-09 08:10:16 -07:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2019-01-13 13:01:16 -07:00
|
|
|
using System;
|
2018-12-27 16:27:57 -07:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
2019-01-13 12:25:11 -07:00
|
|
|
using MediaBrowser.Common.Plugins;
|
|
|
|
using MediaBrowser.Model.Events;
|
|
|
|
using MediaBrowser.Model.Updates;
|
2018-12-27 16:27:57 -07:00
|
|
|
|
|
|
|
namespace MediaBrowser.Common.Updates
|
|
|
|
{
|
|
|
|
public interface IInstallationManager : IDisposable
|
|
|
|
{
|
|
|
|
event EventHandler<InstallationEventArgs> PackageInstalling;
|
2019-11-07 02:55:02 -07:00
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
event EventHandler<InstallationEventArgs> PackageInstallationCompleted;
|
2019-11-07 02:55:02 -07:00
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
event EventHandler<InstallationFailedEventArgs> PackageInstallationFailed;
|
2019-11-07 02:55:02 -07:00
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
event EventHandler<InstallationEventArgs> PackageInstallationCancelled;
|
|
|
|
|
|
|
|
/// <summary>
|
2019-11-07 02:55:02 -07:00
|
|
|
/// Occurs when a plugin is uninstalled.
|
2018-12-27 16:27:57 -07:00
|
|
|
/// </summary>
|
|
|
|
event EventHandler<GenericEventArgs<IPlugin>> PluginUninstalled;
|
|
|
|
|
|
|
|
/// <summary>
|
2019-11-07 02:55:02 -07:00
|
|
|
/// Occurs when a plugin is updated.
|
2018-12-27 16:27:57 -07:00
|
|
|
/// </summary>
|
2019-06-14 09:38:14 -07:00
|
|
|
event EventHandler<GenericEventArgs<(IPlugin, PackageVersionInfo)>> PluginUpdated;
|
2018-12-27 16:27:57 -07:00
|
|
|
|
|
|
|
/// <summary>
|
2019-11-07 02:55:02 -07:00
|
|
|
/// Occurs when a plugin is installed.
|
2018-12-27 16:27:57 -07:00
|
|
|
/// </summary>
|
|
|
|
event EventHandler<GenericEventArgs<PackageVersionInfo>> PluginInstalled;
|
|
|
|
|
|
|
|
/// <summary>
|
2019-11-09 12:23:09 -07:00
|
|
|
/// Gets the completed installations.
|
2018-12-27 16:27:57 -07:00
|
|
|
/// </summary>
|
2019-10-08 11:51:11 -07:00
|
|
|
IEnumerable<InstallationInfo> CompletedInstallations { get; }
|
2018-12-27 16:27:57 -07:00
|
|
|
|
|
|
|
/// <summary>
|
2019-10-08 11:51:11 -07:00
|
|
|
/// Gets all available packages.
|
2018-12-27 16:27:57 -07:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
2019-10-08 11:51:11 -07:00
|
|
|
/// <returns>Task{IReadOnlyList{PackageInfo}}.</returns>
|
|
|
|
Task<IReadOnlyList<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken = default);
|
2018-12-27 16:27:57 -07:00
|
|
|
|
|
|
|
/// <summary>
|
2019-10-08 11:51:11 -07:00
|
|
|
/// Returns all plugins matching the requirements.
|
2018-12-27 16:27:57 -07:00
|
|
|
/// </summary>
|
2019-10-08 11:51:11 -07:00
|
|
|
/// <param name="availablePackages">The available packages.</param>
|
|
|
|
/// <param name="name">The name of the plugin.</param>
|
|
|
|
/// <param name="guid">The id of the plugin.</param>
|
|
|
|
/// <returns>All plugins matching the requirements.</returns>
|
|
|
|
IEnumerable<PackageInfo> FilterPackages(
|
|
|
|
IEnumerable<PackageInfo> availablePackages,
|
|
|
|
string name = null,
|
|
|
|
Guid guid = default);
|
2018-12-27 16:27:57 -07:00
|
|
|
|
|
|
|
/// <summary>
|
2019-10-08 11:51:11 -07:00
|
|
|
/// Returns all compatible versions ordered from newest to oldest.
|
2018-12-27 16:27:57 -07:00
|
|
|
/// </summary>
|
2019-10-08 11:51:11 -07:00
|
|
|
/// <param name="availableVersions">The available version of the plugin.</param>
|
|
|
|
/// <param name="minVersion">The minimum required version of the plugin.</param>
|
|
|
|
/// <param name="classification">The classification of updates.</param>
|
|
|
|
/// <returns>All compatible versions ordered from newest to oldest.</returns>
|
|
|
|
IEnumerable<PackageVersionInfo> GetCompatibleVersions(
|
|
|
|
IEnumerable<PackageVersionInfo> availableVersions,
|
|
|
|
Version minVersion = null,
|
|
|
|
PackageVersionClass classification = PackageVersionClass.Release);
|
2018-12-27 16:27:57 -07:00
|
|
|
|
|
|
|
/// <summary>
|
2019-10-08 11:51:11 -07:00
|
|
|
/// Returns all compatible versions ordered from newest to oldest.
|
2018-12-27 16:27:57 -07:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="availablePackages">The available packages.</param>
|
|
|
|
/// <param name="name">The name.</param>
|
2019-10-08 11:51:11 -07:00
|
|
|
/// <param name="guid">The guid of the plugin.</param>
|
|
|
|
/// <param name="minVersion">The minimum required version of the plugin.</param>
|
2018-12-27 16:27:57 -07:00
|
|
|
/// <param name="classification">The classification.</param>
|
2019-10-08 11:51:11 -07:00
|
|
|
/// <returns>All compatible versions ordered from newest to oldest.</returns>
|
|
|
|
IEnumerable<PackageVersionInfo> GetCompatibleVersions(
|
|
|
|
IEnumerable<PackageInfo> availablePackages,
|
|
|
|
string name = null,
|
|
|
|
Guid guid = default,
|
|
|
|
Version minVersion = null,
|
|
|
|
PackageVersionClass classification = PackageVersionClass.Release);
|
2018-12-27 16:27:57 -07:00
|
|
|
|
|
|
|
/// <summary>
|
2019-10-08 11:51:11 -07:00
|
|
|
/// Returns the available plugin updates.
|
2018-12-27 16:27:57 -07:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
2019-11-09 12:23:09 -07:00
|
|
|
/// <returns>The available plugin updates.</returns>
|
2019-11-24 09:08:28 -07:00
|
|
|
IAsyncEnumerable<PackageVersionInfo> GetAvailablePluginUpdates(CancellationToken cancellationToken = default);
|
2018-12-27 16:27:57 -07:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Installs the package.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="package">The package.</param>
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
2019-07-29 14:47:25 -07:00
|
|
|
/// <returns><see cref="Task" />.</returns>
|
2019-08-11 06:57:36 -07:00
|
|
|
Task InstallPackage(PackageVersionInfo package, CancellationToken cancellationToken = default);
|
2018-12-27 16:27:57 -07:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Uninstalls a plugin
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="plugin">The plugin.</param>
|
2019-01-13 13:37:13 -07:00
|
|
|
/// <exception cref="ArgumentException"></exception>
|
2018-12-27 16:27:57 -07:00
|
|
|
void UninstallPlugin(IPlugin plugin);
|
2019-06-14 09:38:14 -07:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Cancels the installation
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id">The id of the package that is being installed</param>
|
|
|
|
/// <returns>Returns true if the install was cancelled</returns>
|
|
|
|
bool CancelInstallation(Guid id);
|
2018-12-27 16:27:57 -07:00
|
|
|
}
|
2019-01-13 12:30:41 -07:00
|
|
|
}
|