feat: parse release note for resource updater (#12092)

* feat: parse release note for resource udpater

* feat: parse release note for resource udpater

* feat: toast 显示版本信息

* style: whitespace for EN

---------

Co-authored-by: uye <99072975+ABA2396@users.noreply.github.com>
Co-authored-by: Constrat <56174894+Constrat@users.noreply.github.com>
This commit is contained in:
MistEO
2025-03-07 17:43:02 +08:00
committed by GitHub
parent d354f5cefe
commit f5e17393a7
7 changed files with 42 additions and 435 deletions

View File

@@ -20,11 +20,9 @@ using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows;
using MaaWpfGui.Constants;
using MaaWpfGui.Extensions;
using MaaWpfGui.Helper;
using MaaWpfGui.Main;
using MaaWpfGui.Models;
using MaaWpfGui.Properties;
using MaaWpfGui.Services;
@@ -392,6 +390,7 @@ public class VersionUpdateSettingsUserControlModel : PropertyChangedBase
/// Updates manually.
/// </summary>
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
/// ReSharper disable once UnusedMember.Global
public async Task ManualUpdate()
{
var ret = await Instances.VersionUpdateViewModel.CheckAndDownloadVersionUpdate();
@@ -422,11 +421,12 @@ public class VersionUpdateSettingsUserControlModel : PropertyChangedBase
}
}
// ReSharper disable once UnusedMember.Global
public async Task ManualUpdateResource()
{
IsCheckingForUpdates = true;
var (ret, uri) = await ResourceUpdater.CheckFromMirrorChyanAsync();
var (ret, uri, releaseNote) = await ResourceUpdater.CheckFromMirrorChyanAsync();
var toastMessage = ret switch
{
VersionUpdateViewModel.CheckUpdateRetT.NoNeedToUpdate => string.Empty,
@@ -456,7 +456,7 @@ public class VersionUpdateSettingsUserControlModel : PropertyChangedBase
bool success = UpdateSource switch
{
"Github" => await ResourceUpdater.UpdateFromGithubAsync(),
"MirrorChyan" => (ret == VersionUpdateViewModel.CheckUpdateRetT.OK) && await ResourceUpdater.DownloadFromMirrorChyanAsync(uri),
"MirrorChyan" => (ret == VersionUpdateViewModel.CheckUpdateRetT.OK) && await ResourceUpdater.DownloadFromMirrorChyanAsync(uri, releaseNote),
_ => await ResourceUpdater.UpdateFromGithubAsync(),
};