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;