diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj
index b136eb43c5..a10f36da00 100644
--- a/MediaBrowser.Common/MediaBrowser.Common.csproj
+++ b/MediaBrowser.Common/MediaBrowser.Common.csproj
@@ -135,6 +135,7 @@
+
diff --git a/MediaBrowser.Common/Updates/IInstallationManager.cs b/MediaBrowser.Common/Updates/IInstallationManager.cs
new file mode 100644
index 0000000000..23c1477487
--- /dev/null
+++ b/MediaBrowser.Common/Updates/IInstallationManager.cs
@@ -0,0 +1,119 @@
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+using MediaBrowser.Common.Events;
+using MediaBrowser.Common.Plugins;
+using MediaBrowser.Model.Updates;
+
+namespace MediaBrowser.Common.Updates
+{
+ public interface IInstallationManager
+ {
+ ///
+ /// The current installations
+ ///
+ List> CurrentInstallations { get; set; }
+
+ ///
+ /// The completed installations
+ ///
+ ConcurrentBag CompletedInstallations { get; set; }
+
+ ///
+ /// Occurs when [plugin uninstalled].
+ ///
+ event EventHandler> PluginUninstalled;
+
+ ///
+ /// Occurs when [plugin updated].
+ ///
+ event EventHandler>> PluginUpdated;
+
+ ///
+ /// Called when [plugin updated].
+ ///
+ /// The plugin.
+ /// The new version.
+ void OnPluginUpdated(IPlugin plugin, PackageVersionInfo newVersion);
+
+ ///
+ /// Occurs when [plugin updated].
+ ///
+ event EventHandler> PluginInstalled;
+
+ ///
+ /// Called when [plugin installed].
+ ///
+ /// The package.
+ void OnPluginInstalled(PackageVersionInfo package);
+
+ ///
+ /// Gets all available packages.
+ ///
+ /// The cancellation token.
+ /// Type of the package.
+ /// The application version.
+ /// Task{List{PackageInfo}}.
+ Task> GetAvailablePackages(CancellationToken cancellationToken,
+ PackageType? packageType = null,
+ Version applicationVersion = null);
+
+ ///
+ /// Gets the package.
+ ///
+ /// The name.
+ /// The classification.
+ /// The version.
+ /// Task{PackageVersionInfo}.
+ Task GetPackage(string name, PackageVersionClass classification, Version version);
+
+ ///
+ /// Gets the latest compatible version.
+ ///
+ /// The name.
+ /// The classification.
+ /// Task{PackageVersionInfo}.
+ Task GetLatestCompatibleVersion(string name, PackageVersionClass classification = PackageVersionClass.Release);
+
+ ///
+ /// Gets the latest compatible version.
+ ///
+ /// The available packages.
+ /// The name.
+ /// The classification.
+ /// PackageVersionInfo.
+ PackageVersionInfo GetLatestCompatibleVersion(IEnumerable availablePackages, string name, PackageVersionClass classification = PackageVersionClass.Release);
+
+ ///
+ /// Gets the available plugin updates.
+ ///
+ /// if set to true [with auto update enabled].
+ /// The cancellation token.
+ /// Task{IEnumerable{PackageVersionInfo}}.
+ Task> GetAvailablePluginUpdates(bool withAutoUpdateEnabled, CancellationToken cancellationToken);
+
+ ///
+ /// Installs the package.
+ ///
+ /// The package.
+ /// The progress.
+ /// The cancellation token.
+ /// Task.
+ /// package
+ Task InstallPackage(PackageVersionInfo package, IProgress progress, CancellationToken cancellationToken);
+
+ ///
+ /// Uninstalls a plugin
+ ///
+ /// The plugin.
+ ///
+ void UninstallPlugin(IPlugin plugin);
+
+ ///
+ /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
+ ///
+ void Dispose();
+ }
+}
\ No newline at end of file
diff --git a/MediaBrowser.Controller/Kernel.cs b/MediaBrowser.Controller/Kernel.cs
index 7cb838e44c..a4af76805b 100644
--- a/MediaBrowser.Controller/Kernel.cs
+++ b/MediaBrowser.Controller/Kernel.cs
@@ -1,6 +1,7 @@
using MediaBrowser.Common.Kernel;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Common.ScheduledTasks;
+using MediaBrowser.Common.Updates;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.IO;
@@ -70,7 +71,7 @@ namespace MediaBrowser.Controller
/// Gets the installation manager.
///
/// The installation manager.
- public InstallationManager InstallationManager { get; private set; }
+ public IInstallationManager InstallationManager { get; private set; }
///
/// Gets or sets the file system manager.
diff --git a/MediaBrowser.Controller/Updates/InstallationManager.cs b/MediaBrowser.Controller/Updates/InstallationManager.cs
index efef87f863..64b72ae636 100644
--- a/MediaBrowser.Controller/Updates/InstallationManager.cs
+++ b/MediaBrowser.Controller/Updates/InstallationManager.cs
@@ -3,6 +3,7 @@ using MediaBrowser.Common.Kernel;
using MediaBrowser.Common.Net;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Common.Progress;
+using MediaBrowser.Common.Updates;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
@@ -21,18 +22,18 @@ namespace MediaBrowser.Controller.Updates
///
/// Manages all install, uninstall and update operations (both plugins and system)
///
- public class InstallationManager : BaseManager
+ public class InstallationManager : BaseManager, IInstallationManager
{
///
/// The current installations
///
- public readonly List> CurrentInstallations =
- new List>();
+ public List> CurrentInstallations { get; set; }
+
///
/// The completed installations
///
- public readonly ConcurrentBag CompletedInstallations = new ConcurrentBag();
+ public ConcurrentBag CompletedInstallations { get; set; }
#region PluginUninstalled Event
///
@@ -161,6 +162,8 @@ namespace MediaBrowser.Controller.Updates
throw new ArgumentNullException("httpClient");
}
+ CurrentInstallations = new List>();
+ CompletedInstallations = new ConcurrentBag();
JsonSerializer = jsonSerializer;
HttpClient = httpClient;
ApplicationHost = appHost;