From f832cbc1648064467ebaadadc16a183c62590ca6 Mon Sep 17 00:00:00 2001 From: Chr_ Date: Tue, 18 Jun 2024 22:11:40 +0800 Subject: [PATCH] =?UTF-8?q?misc=20=E4=BF=AE=E6=94=B9=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ASFEnhance/ASFEnhance.cs | 28 +++++++++++++++++++++++++--- Directory.Build.props | 2 +- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/ASFEnhance/ASFEnhance.cs b/ASFEnhance/ASFEnhance.cs index c0454431..dc490685 100644 --- a/ASFEnhance/ASFEnhance.cs +++ b/ASFEnhance/ASFEnhance.cs @@ -2,13 +2,16 @@ using ArchiSteamFarm.Plugins.Interfaces; using ArchiSteamFarm.Steam; using ArchiSteamFarm.Web.GitHub; +using ArchiSteamFarm.Web.GitHub.Data; using ASFEnhance.Data.Plugin; using System.ComponentModel; using System.Composition; +using System.Globalization; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; using static ArchiSteamFarm.Storage.GlobalConfig; +using static SteamKit2.GC.Dota.Internal.CMsgDOTALeague; namespace ASFEnhance; @@ -1238,14 +1241,33 @@ public Task OnBotFriendRequest(Bot bot, ulong steamId) /// public async Task GetTargetReleaseURL(Version asfVersion, string asfVariant, bool asfUpdate, EUpdateChannel updateChannel, bool forced) { - var response = await GitHubService.GetLatestRelease("chr233/ASFEnhance", true, default).ConfigureAwait(false); - if (response == null) + var releaseResponse = await GitHubService.GetLatestRelease("chr233/ASFEnhance", true, default).ConfigureAwait(false); + if (releaseResponse == null) { return null; } - var releaseUrl = Update.WebRequest.FetchDownloadUrl(response); + Version newVersion = new(releaseResponse.Tag); + if (!forced && (Version >= newVersion)) + { + ASFLogger.LogGenericInfo(string.Format(Langs.UpdatePluginListItemName, Name, Langs.AlreadyLatest)); + return null; + } + + if (releaseResponse.Assets.Count == 0) + { + ASFLogger.LogGenericWarning(Langs.NoAssetFoundInReleaseInfo); + return null; + } + + ASFLogger.LogGenericInfo(string.Format(Langs.UpdatePluginListItemName, Name, Langs.CanUpdate)); + ASFLogger.LogGenericInfo(string.Format(Langs.UpdatePluginListItemVersion, Version, newVersion)); + if (!string.IsNullOrEmpty(releaseResponse.MarkdownBody)) + { + ASFLogger.LogGenericInfo(string.Format(Langs.UpdatePluginListItemReleaseNote, releaseResponse.MarkdownBody)); + } + var releaseUrl = Update.WebRequest.FetchDownloadUrl(releaseResponse); return releaseUrl; } } diff --git a/Directory.Build.props b/Directory.Build.props index 3f5c13c4..9c28cf4f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 2.1.8.1 + 2.1.8.2