diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-09-30 18:18:44 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-09-30 18:18:44 -0400 |
| commit | 75dd40a2ea35af4f941d468f99506a7a131e2800 (patch) | |
| tree | f1e040f0317d7522d434557d83092b4db8dd97ae /MediaBrowser.Common.Implementations | |
| parent | a7c8750b52d213ced122bd54c69936fb2379068c (diff) | |
add ability to install pismo
Diffstat (limited to 'MediaBrowser.Common.Implementations')
| -rw-r--r-- | MediaBrowser.Common.Implementations/BaseApplicationHost.cs | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index 8bd203dcd..fe0abcae0 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -1,6 +1,7 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Events; using MediaBrowser.Common.Implementations.Archiving; +using MediaBrowser.Common.Implementations.IO; using MediaBrowser.Common.Implementations.NetworkManagement; using MediaBrowser.Common.Implementations.ScheduledTasks; using MediaBrowser.Common.Implementations.Security; @@ -156,6 +157,8 @@ namespace MediaBrowser.Common.Implementations /// </summary> /// <value>The zip client.</value> protected IZipClient ZipClient { get; set; } + + protected IIsoManager IsoManager { get; set; } /// <summary> /// Initializes a new instance of the <see cref="BaseApplicationHost{TApplicationPathsType}"/> class. @@ -193,18 +196,54 @@ namespace MediaBrowser.Common.Implementations await RegisterResources().ConfigureAwait(false); FindParts(); + + await InstallIsoMounters(CancellationToken.None).ConfigureAwait(false); } + /// <summary> + /// Called when [logger loaded]. + /// </summary> protected virtual void OnLoggerLoaded() { } /// <summary> + /// Installs the iso mounters. + /// </summary> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task.</returns> + private async Task InstallIsoMounters(CancellationToken cancellationToken) + { + var list = new List<IIsoMounter>(); + + foreach (var isoMounter in GetExports<IIsoMounter>()) + { + try + { + if (isoMounter.RequiresInstallation && !isoMounter.IsInstalled) + { + Logger.Info("Installing {0}", isoMounter.Name); + + await isoMounter.Install(cancellationToken).ConfigureAwait(false); + } + + list.Add(isoMounter); + } + catch (Exception ex) + { + Logger.ErrorException("{0} failed to load.", ex, isoMounter.Name); + } + } + + IsoManager.AddParts(list); + } + + /// <summary> /// Runs the startup tasks. /// </summary> /// <returns>Task.</returns> - public virtual Task RunStartupTasks() + public virtual Task RunStartupTasks() { return Task.Run(() => { @@ -307,6 +346,9 @@ namespace MediaBrowser.Common.Implementations ZipClient = new ZipClient(); RegisterSingleInstance(ZipClient); + + IsoManager = new IsoManager(); + RegisterSingleInstance(IsoManager); }); } |
