From bce51756411dcfc026122f035acf072db87ff109 Mon Sep 17 00:00:00 2001 From: MistEO Date: Fri, 7 Apr 2023 23:23:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E7=88=86=E7=82=B8=E6=97=B6=E4=B8=8D=E5=B0=9D?= =?UTF-8?q?=E8=AF=95=E5=85=B6=E4=BB=96=E9=95=9C=E5=83=8F=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E5=88=A0=E6=8E=89=E5=87=A0=E4=B8=AA=E7=88=86?= =?UTF-8?q?=E7=82=B8=E7=9A=84=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/UI/VersionUpdateViewModel.cs | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs b/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs index d3911263a6..9a3abf63e7 100644 --- a/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs @@ -72,7 +72,7 @@ namespace MaaWpfGui.ViewModels.UI return Regex.Replace(text, @"([^\[`]|^)@([^\s]+)", "$1[@$2](https://github.com/$2)"); } - private readonly string _curVersion = Marshal.PtrToStringAnsi(AsstGetVersion()); + private readonly string _curVersion = "v4.13.0-rc.1"; //Marshal.PtrToStringAnsi(AsstGetVersion()); private string _latestVersion; private string _updateTag = ConfigurationHelper.GetValue(ConfigurationKeys.VersionName, string.Empty); @@ -362,7 +362,8 @@ namespace MaaWpfGui.ViewModels.UI { _settingsViewModel.IsCheckingForUpdates = true; - async Task CheckUpdateInner() { + async Task CheckUpdateInner() + { // 检查更新 var checkRet = await CheckUpdate(force); if (checkRet != CheckUpdateRetT.OK) @@ -464,10 +465,7 @@ namespace MaaWpfGui.ViewModels.UI var mirroredReplaceMap = new List> { new Tuple("github.com", "agent.imgg.dev"), - new Tuple("https://", "https://git.114514.pro/https://"), - new Tuple("https://", "https://ghproxy.com/https://"), new Tuple("github.com", "ota.maa.plus"), - new Tuple("github.com", "download.fastgit.org"), null, }; @@ -475,9 +473,9 @@ namespace MaaWpfGui.ViewModels.UI const int DownloadRetryMaxTimes = 1; for (int i = 0; i <= DownloadRetryMaxTimes && !downloaded; i++) { - var url = rawUrl; foreach (var repTuple in mirroredReplaceMap) { + var url = string.Copy(rawUrl); if (repTuple != null) { url = url.Replace(repTuple.Item1, repTuple.Item2); @@ -703,11 +701,18 @@ namespace MaaWpfGui.ViewModels.UI private async Task DownloadGithubAssets(string url, JObject assetsObject) { _logItemViewModels = _taskQueueViewModel.LogItemViewModels; - return await _httpService.DownloadFileAsync( - new Uri(url), - assetsObject["name"].ToString(), - assetsObject["content_type"].ToString()) - .ConfigureAwait(false); + try + { + return await _httpService.DownloadFileAsync( + new Uri(url), + assetsObject["name"].ToString(), + assetsObject["content_type"].ToString()) + .ConfigureAwait(false); + } + catch (Exception) + { + return false; + } } private static ObservableCollection _logItemViewModels = null;