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