|
|
@ -11,6 +11,8 @@ using NuGet.Versioning; |
|
|
|
|
|
|
|
|
|
|
|
namespace ICSharpCode.ILSpyCmd |
|
|
|
namespace ICSharpCode.ILSpyCmd |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
internal record PackageCheckResult(NuGetVersion RunningVersion, NuGetVersion LatestVersion, bool UpdateRecommendation); |
|
|
|
|
|
|
|
|
|
|
|
// Idea from https://github.com/ErikEJ/EFCorePowerTools/blob/master/src/GUI/efcpt/Services/PackageService.cs
|
|
|
|
// Idea from https://github.com/ErikEJ/EFCorePowerTools/blob/master/src/GUI/efcpt/Services/PackageService.cs
|
|
|
|
internal static class DotNetToolUpdateChecker |
|
|
|
internal static class DotNetToolUpdateChecker |
|
|
|
{ |
|
|
|
{ |
|
|
@ -20,7 +22,7 @@ namespace ICSharpCode.ILSpyCmd |
|
|
|
.InformationalVersion); |
|
|
|
.InformationalVersion); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static async Task<NuGetVersion> CheckForPackageUpdateAsync(string packageId) |
|
|
|
public static async Task<PackageCheckResult> CheckForPackageUpdateAsync(string packageId) |
|
|
|
{ |
|
|
|
{ |
|
|
|
try |
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
@ -35,10 +37,10 @@ namespace ICSharpCode.ILSpyCmd |
|
|
|
CancellationToken.None).ConfigureAwait(false); |
|
|
|
CancellationToken.None).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
var latestVersion = versions.Where(v => v.Release == "").MaxBy(v => v); |
|
|
|
var latestVersion = versions.Where(v => v.Release == "").MaxBy(v => v); |
|
|
|
if (latestVersion > CurrentPackageVersion()) |
|
|
|
var runningVersion = CurrentPackageVersion(); |
|
|
|
{ |
|
|
|
int comparisonResult = latestVersion.CompareTo(runningVersion, VersionComparison.Version); |
|
|
|
return latestVersion; |
|
|
|
|
|
|
|
} |
|
|
|
return new PackageCheckResult(runningVersion, latestVersion, comparisonResult > 0); |
|
|
|
} |
|
|
|
} |
|
|
|
#pragma warning disable RCS1075 // Avoid empty catch clause that catches System.Exception.
|
|
|
|
#pragma warning disable RCS1075 // Avoid empty catch clause that catches System.Exception.
|
|
|
|
catch (Exception) |
|
|
|
catch (Exception) |
|
|
|