From 889ce81d0304e6fa05c0217a767468861ecb4e67 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 13 Sep 2013 21:56:03 -0400 Subject: updated nuget --- .../BaseApplicationHost.cs | 57 +++++++--------------- 1 file changed, 17 insertions(+), 40 deletions(-) (limited to 'MediaBrowser.Common.Implementations/BaseApplicationHost.cs') diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index 90cb59bbe..bb8b7d80e 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -149,7 +149,7 @@ namespace MediaBrowser.Common.Implementations /// /// The installation manager. protected IInstallationManager InstallationManager { get; set; } - + /// /// Initializes a new instance of the class. /// @@ -186,7 +186,7 @@ namespace MediaBrowser.Common.Implementations protected virtual void OnLoggerLoaded() { - + } /// @@ -471,7 +471,7 @@ namespace MediaBrowser.Common.Implementations { ConfigureAutoRunAtStartup(); } - + /// /// Configures the auto run at startup. /// @@ -480,7 +480,7 @@ namespace MediaBrowser.Common.Implementations if (ConfigurationManager.CommonConfiguration.RunAtStartup) { //Copy our shortut into the startup folder for this user - File.Copy(ProductShortcutPath, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup),Path.GetFileName(ProductShortcutPath) ?? "MBstartup.lnk"), true); + File.Copy(ProductShortcutPath, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), Path.GetFileName(ProductShortcutPath) ?? "MBstartup.lnk"), true); } else { @@ -566,56 +566,33 @@ namespace MediaBrowser.Common.Implementations /// The cancellation token. /// The progress. /// Task{CheckForUpdateResult}. - public async Task CheckForApplicationUpdate(CancellationToken cancellationToken, - IProgress progress) - { - var result = await CheckForApplicationUpdateInternal(cancellationToken, progress).ConfigureAwait(false); - - return result; - } + public abstract Task CheckForApplicationUpdate(CancellationToken cancellationToken, + IProgress progress); /// - /// Checks for application update internal. + /// Updates the application. /// + /// The package that contains the update /// The cancellation token. /// The progress. - /// Task{CheckForUpdateResult}. - private async Task CheckForApplicationUpdateInternal(CancellationToken cancellationToken, - IProgress progress) - { - var availablePackages = await InstallationManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false); - - var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, ApplicationUpdatePackageName, ConfigurationManager.CommonConfiguration.SystemUpdateLevel); - - return version != null ? new CheckForUpdateResult { AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version } : - new CheckForUpdateResult { AvailableVersion = ApplicationVersion, IsUpdateAvailable = false }; - } + /// Task. + public abstract Task UpdateApplication(PackageVersionInfo package, CancellationToken cancellationToken, + IProgress progress); /// - /// Gets the name of the application update package. + /// Shuts down. /// - /// The name of the application update package. - protected abstract string ApplicationUpdatePackageName { get; } + public abstract void Shutdown(); /// - /// Updates the application. + /// Called when [application updated]. /// - /// The package that contains the update - /// The cancellation token. - /// The progress. - /// Task. - public async Task UpdateApplication(PackageVersionInfo package, CancellationToken cancellationToken, IProgress progress) + /// The new version. + protected void OnApplicationUpdated(Version newVersion) { - await InstallationManager.InstallPackage(package, progress, cancellationToken).ConfigureAwait(false); - - EventHelper.QueueEventIfNotNull(ApplicationUpdated, this, new GenericEventArgs { Argument = package.version }, Logger); + EventHelper.QueueEventIfNotNull(ApplicationUpdated, this, new GenericEventArgs { Argument = newVersion }, Logger); NotifyPendingRestart(); } - - /// - /// Shuts down. - /// - public abstract void Shutdown(); } } -- cgit v1.2.3