mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-03 06:18:28 +01:00
updated nuget
This commit is contained in:
@@ -1183,24 +1183,18 @@ namespace MediaBrowser.ServerApplication
|
||||
/// <returns>Task{CheckForUpdateResult}.</returns>
|
||||
public override async Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress)
|
||||
{
|
||||
var availablePackages = await InstallationManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
|
||||
var result = await NativeApp.CheckForApplicationUpdate(ApplicationVersion,
|
||||
ConfigurationManager.CommonConfiguration.SystemUpdateLevel, InstallationManager,
|
||||
cancellationToken, progress).ConfigureAwait(false);
|
||||
|
||||
var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, "MBServer", null, ApplicationVersion,
|
||||
ConfigurationManager.CommonConfiguration.SystemUpdateLevel);
|
||||
HasUpdateAvailable = result.IsUpdateAvailable;
|
||||
|
||||
var versionObject = version == null || string.IsNullOrWhiteSpace(version.versionStr) ? null : new Version(version.versionStr);
|
||||
|
||||
var isUpdateAvailable = versionObject != null && versionObject > ApplicationVersion;
|
||||
HasUpdateAvailable = isUpdateAvailable;
|
||||
|
||||
if (isUpdateAvailable)
|
||||
if (result.IsUpdateAvailable)
|
||||
{
|
||||
Logger.Info("New application version is available: {0}", versionObject);
|
||||
Logger.Info("New application version is available: {0}", result.AvailableVersion);
|
||||
}
|
||||
|
||||
return versionObject != null ?
|
||||
new CheckForUpdateResult { AvailableVersion = versionObject.ToString(), IsUpdateAvailable = isUpdateAvailable, Package = version } :
|
||||
new CheckForUpdateResult { AvailableVersion = ApplicationVersion.ToString(), IsUpdateAvailable = false };
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Updates;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Updates;
|
||||
|
||||
namespace MediaBrowser.ServerApplication.Native
|
||||
{
|
||||
@@ -84,5 +90,24 @@ namespace MediaBrowser.ServerApplication.Native
|
||||
EXECUTION_STATE es = SetThreadExecutionState(EXECUTION_STATE.ES_SYSTEM_REQUIRED);
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<CheckForUpdateResult> CheckForApplicationUpdate(Version currentVersion,
|
||||
PackageVersionClass updateLevel,
|
||||
IInstallationManager installationManager,
|
||||
CancellationToken cancellationToken,
|
||||
IProgress<double> progress)
|
||||
{
|
||||
var availablePackages = await installationManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var version = installationManager.GetLatestCompatibleVersion(availablePackages, "MBServer", null, currentVersion, updateLevel);
|
||||
|
||||
var versionObject = version == null || string.IsNullOrWhiteSpace(version.versionStr) ? null : new Version(version.versionStr);
|
||||
|
||||
var isUpdateAvailable = versionObject != null && versionObject > currentVersion;
|
||||
|
||||
return versionObject != null ?
|
||||
new CheckForUpdateResult { AvailableVersion = versionObject.ToString(), IsUpdateAvailable = isUpdateAvailable, Package = version } :
|
||||
new CheckForUpdateResult { AvailableVersion = currentVersion.ToString(), IsUpdateAvailable = false };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user