From 868a7ce9c8b50bd64c8b5ae33fec77abfd25ef7c Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Thu, 21 Feb 2013 23:23:06 -0500 Subject: isolated clickonce dependancies --- MediaBrowser.Common/Kernel/BaseKernel.cs | 19 +++++++--------- MediaBrowser.Common/Kernel/IApplicationHost.cs | 30 +++++++++++++++++++++++++- MediaBrowser.Common/Kernel/TcpManager.cs | 11 ++++++++-- 3 files changed, 46 insertions(+), 14 deletions(-) (limited to 'MediaBrowser.Common/Kernel') diff --git a/MediaBrowser.Common/Kernel/BaseKernel.cs b/MediaBrowser.Common/Kernel/BaseKernel.cs index a4ac70749..d172d0a0d 100644 --- a/MediaBrowser.Common/Kernel/BaseKernel.cs +++ b/MediaBrowser.Common/Kernel/BaseKernel.cs @@ -13,7 +13,6 @@ using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.ComponentModel.Composition.Hosting; -using System.Deployment.Application; using System.Diagnostics; using System.IO; using System.Linq; @@ -155,12 +154,6 @@ namespace MediaBrowser.Common.Kernel /// true if this instance is first run; otherwise, false. public bool IsFirstRun { get; private set; } - /// - /// The version of the application to display - /// - /// The display version. - public string DisplayVersion { get { return ApplicationVersion.ToString(); } } - /// /// Gets or sets a value indicating whether this instance has changes that require the entire application to restart. /// @@ -325,7 +318,10 @@ namespace MediaBrowser.Common.Kernel /// Gets the log file path. /// /// The log file path. - public string LogFilePath { get; private set; } + public string LogFilePath + { + get { return ApplicationHost.LogFilePath; } + } /// /// Gets the logger. @@ -429,7 +425,7 @@ namespace MediaBrowser.Common.Kernel await ReloadComposableParts().ConfigureAwait(false); DisposeTcpManager(); - TcpManager = new TcpManager(this, Logger); + TcpManager = new TcpManager(ApplicationHost, this, Logger); } /// @@ -482,6 +478,7 @@ namespace MediaBrowser.Common.Kernel protected virtual void ComposeExportedValues(CompositionContainer container) { container.ComposeExportedValue("logger", Logger); + container.ComposeExportedValue("appHost", ApplicationHost); } /// @@ -729,8 +726,8 @@ namespace MediaBrowser.Common.Kernel return new SystemInfo { HasPendingRestart = HasPendingRestart, - Version = DisplayVersion, - IsNetworkDeployed = ApplicationDeployment.IsNetworkDeployed, + Version = ApplicationVersion.ToString(), + IsNetworkDeployed = ApplicationHost.CanSelfUpdate, WebSocketPortNumber = TcpManager.WebSocketPortNumber, SupportsNativeWebSocket = TcpManager.SupportsNativeWebSocket, FailedPluginAssemblies = FailedPluginAssemblies.ToArray() diff --git a/MediaBrowser.Common/Kernel/IApplicationHost.cs b/MediaBrowser.Common/Kernel/IApplicationHost.cs index c1b63c261..63c63eb3d 100644 --- a/MediaBrowser.Common/Kernel/IApplicationHost.cs +++ b/MediaBrowser.Common/Kernel/IApplicationHost.cs @@ -1,4 +1,8 @@ - +using MediaBrowser.Model.Updates; +using System; +using System.Threading; +using System.Threading.Tasks; + namespace MediaBrowser.Common.Kernel { /// @@ -15,5 +19,29 @@ namespace MediaBrowser.Common.Kernel /// Reloads the logger. /// void ReloadLogger(); + + /// + /// Gets the log file path. + /// + /// The log file path. + string LogFilePath { get; } + + /// + /// Gets or sets a value indicating whether this instance can self update. + /// + /// true if this instance can self update; otherwise, false. + bool CanSelfUpdate { get; } + + /// + /// Checks for update. + /// + /// Task{CheckForUpdateResult}. + Task CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress progress); + + /// + /// Updates the application. + /// + /// Task. + Task UpdateApplication(CancellationToken cancellationToken, IProgress progress); } } diff --git a/MediaBrowser.Common/Kernel/TcpManager.cs b/MediaBrowser.Common/Kernel/TcpManager.cs index 7fb624f73..086815cbf 100644 --- a/MediaBrowser.Common/Kernel/TcpManager.cs +++ b/MediaBrowser.Common/Kernel/TcpManager.cs @@ -64,6 +64,11 @@ namespace MediaBrowser.Common.Kernel /// The _logger /// private readonly ILogger _logger; + + /// + /// The _application host + /// + private readonly IApplicationHost _applicationHost; /// /// The _supports native web socket @@ -108,12 +113,14 @@ namespace MediaBrowser.Common.Kernel /// /// Initializes a new instance of the class. /// + /// The application host. /// The kernel. /// The logger. - public TcpManager(IKernel kernel, ILogger logger) + public TcpManager(IApplicationHost applicationHost, IKernel kernel, ILogger logger) : base(kernel) { _logger = logger; + _applicationHost = applicationHost; if (kernel.IsFirstRun) { @@ -182,7 +189,7 @@ namespace MediaBrowser.Common.Kernel try { - HttpServer = new HttpServer(Kernel.HttpServerUrlPrefix, "Media Browser", Kernel, _logger); + HttpServer = new HttpServer(Kernel.HttpServerUrlPrefix, "Media Browser", _applicationHost, Kernel, _logger); } catch (HttpListenerException ex) { -- cgit v1.2.3