2014-05-08 20:09:53 +00:00
|
|
|
|
using MediaBrowser.Common.Plugins;
|
|
|
|
|
using MediaBrowser.Model.Events;
|
2013-03-05 04:25:27 +00:00
|
|
|
|
using MediaBrowser.Model.Updates;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Concurrent;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2013-07-01 02:27:50 +00:00
|
|
|
|
namespace MediaBrowser.Common.Updates
|
2013-03-05 04:25:27 +00:00
|
|
|
|
{
|
|
|
|
|
public interface IInstallationManager : IDisposable
|
|
|
|
|
{
|
2013-07-06 21:23:32 +00:00
|
|
|
|
event EventHandler<InstallationEventArgs> PackageInstalling;
|
|
|
|
|
event EventHandler<InstallationEventArgs> PackageInstallationCompleted;
|
|
|
|
|
event EventHandler<InstallationFailedEventArgs> PackageInstallationFailed;
|
|
|
|
|
event EventHandler<InstallationEventArgs> PackageInstallationCancelled;
|
2013-03-05 04:25:27 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The current installations
|
|
|
|
|
/// </summary>
|
|
|
|
|
List<Tuple<InstallationInfo, CancellationTokenSource>> CurrentInstallations { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The completed installations
|
|
|
|
|
/// </summary>
|
|
|
|
|
ConcurrentBag<InstallationInfo> CompletedInstallations { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [plugin uninstalled].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<GenericEventArgs<IPlugin>> PluginUninstalled;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [plugin updated].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<GenericEventArgs<Tuple<IPlugin, PackageVersionInfo>>> PluginUpdated;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [plugin updated].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<GenericEventArgs<PackageVersionInfo>> PluginInstalled;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets all available packages.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <param name="packageType">Type of the package.</param>
|
|
|
|
|
/// <param name="applicationVersion">The application version.</param>
|
|
|
|
|
/// <returns>Task{List{PackageInfo}}.</returns>
|
|
|
|
|
Task<IEnumerable<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken,
|
|
|
|
|
PackageType? packageType = null,
|
|
|
|
|
Version applicationVersion = null);
|
|
|
|
|
|
2013-08-07 19:15:55 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets all available packages from a static resource.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task{List{PackageInfo}}.</returns>
|
2013-09-30 01:29:38 +00:00
|
|
|
|
Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken);
|
2013-11-04 18:16:47 +00:00
|
|
|
|
|
2013-03-05 04:25:27 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the package.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="name">The name.</param>
|
2013-11-04 18:16:47 +00:00
|
|
|
|
/// <param name="guid">The assembly guid</param>
|
2013-03-05 04:25:27 +00:00
|
|
|
|
/// <param name="classification">The classification.</param>
|
|
|
|
|
/// <param name="version">The version.</param>
|
|
|
|
|
/// <returns>Task{PackageVersionInfo}.</returns>
|
2013-11-04 18:16:47 +00:00
|
|
|
|
Task<PackageVersionInfo> GetPackage(string name, string guid, PackageVersionClass classification, Version version);
|
2013-03-05 04:25:27 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the latest compatible version.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="name">The name.</param>
|
2013-11-04 18:16:47 +00:00
|
|
|
|
/// <param name="guid">The assembly guid</param>
|
2013-09-22 18:21:55 +00:00
|
|
|
|
/// <param name="currentServerVersion">The current server version.</param>
|
2013-03-05 04:25:27 +00:00
|
|
|
|
/// <param name="classification">The classification.</param>
|
|
|
|
|
/// <returns>Task{PackageVersionInfo}.</returns>
|
2013-11-04 18:16:47 +00:00
|
|
|
|
Task<PackageVersionInfo> GetLatestCompatibleVersion(string name, string guid, Version currentServerVersion, PackageVersionClass classification = PackageVersionClass.Release);
|
2013-03-05 04:25:27 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the latest compatible version.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="availablePackages">The available packages.</param>
|
|
|
|
|
/// <param name="name">The name.</param>
|
2013-11-04 18:16:47 +00:00
|
|
|
|
/// <param name="guid">The assembly guid</param>
|
2013-09-22 18:21:55 +00:00
|
|
|
|
/// <param name="currentServerVersion">The current server version.</param>
|
2013-03-05 04:25:27 +00:00
|
|
|
|
/// <param name="classification">The classification.</param>
|
|
|
|
|
/// <returns>PackageVersionInfo.</returns>
|
2013-11-04 18:16:47 +00:00
|
|
|
|
PackageVersionInfo GetLatestCompatibleVersion(IEnumerable<PackageInfo> availablePackages, string name, string guid, Version currentServerVersion, PackageVersionClass classification = PackageVersionClass.Release);
|
2013-03-05 04:25:27 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2013-08-16 18:59:37 +00:00
|
|
|
|
/// Gets the available plugin updates.
|
2013-03-05 04:25:27 +00:00
|
|
|
|
/// </summary>
|
2013-09-30 15:04:38 +00:00
|
|
|
|
/// <param name="applicationVersion">The current server version.</param>
|
2013-03-05 04:25:27 +00:00
|
|
|
|
/// <param name="withAutoUpdateEnabled">if set to <c>true</c> [with auto update enabled].</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task{IEnumerable{PackageVersionInfo}}.</returns>
|
2013-09-30 15:04:38 +00:00
|
|
|
|
Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdates(Version applicationVersion, bool withAutoUpdateEnabled, CancellationToken cancellationToken);
|
2013-03-05 04:25:27 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Installs the package.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="package">The package.</param>
|
|
|
|
|
/// <param name="progress">The progress.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
/// <exception cref="System.ArgumentNullException">package</exception>
|
|
|
|
|
Task InstallPackage(PackageVersionInfo package, IProgress<double> progress, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Uninstalls a plugin
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="plugin">The plugin.</param>
|
|
|
|
|
/// <exception cref="System.ArgumentException"></exception>
|
|
|
|
|
void UninstallPlugin(IPlugin plugin);
|
|
|
|
|
}
|
|
|
|
|
}
|