From f611efce313792e50038debbd099f9fc02593f7a Mon Sep 17 00:00:00 2001
From: uye <99072975+ABA2396@users.noreply.github.com>
Date: Sun, 9 Feb 2025 16:57:39 +0800
Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=E7=95=8C=E9=9D=A2?=
=?UTF-8?q?=E5=B8=83=E5=B1=80=E4=B8=8E=E7=BF=BB=E8=AF=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/MaaWpfGui/Constants/ConfigurationKeys.cs | 4 +--
src/MaaWpfGui/Models/ResourceUpdater.cs | 17 +++++++----
src/MaaWpfGui/Res/Localizations/en-us.xaml | 5 ++--
src/MaaWpfGui/Res/Localizations/ja-jp.xaml | 5 ++--
src/MaaWpfGui/Res/Localizations/ko-kr.xaml | 5 ++--
src/MaaWpfGui/Res/Localizations/zh-cn.xaml | 5 ++--
src/MaaWpfGui/Res/Localizations/zh-tw.xaml | 5 ++--
.../ViewModels/UI/VersionUpdateViewModel.cs | 2 +-
.../VersionUpdateSettingsUserControlModel.cs | 29 +++++++++++++++++--
.../VersionUpdateSettingsUserControl.xaml | 11 +++++++
10 files changed, 66 insertions(+), 22 deletions(-)
diff --git a/src/MaaWpfGui/Constants/ConfigurationKeys.cs b/src/MaaWpfGui/Constants/ConfigurationKeys.cs
index 654dfde76b..811a8b8dae 100644
--- a/src/MaaWpfGui/Constants/ConfigurationKeys.cs
+++ b/src/MaaWpfGui/Constants/ConfigurationKeys.cs
@@ -197,8 +197,8 @@ namespace MaaWpfGui.Constants
public const string ProxyType = "VersionUpdate.ProxyType";
public const string VersionType = "VersionUpdate.VersionType";
- // public const string ResourceUpdateSource = "VersionUpdate.ResourceUpdateSource";
- // MirrorChyanCdk 迁到新配置的话就不用加 ResourceUpdateSource 了,现在本体更新也加上了 MirrorChyan
+ // MirrorChyanCdk 迁到新配置的话就直接叫 UpdateSource,现在本体更新也加上了 MirrorChyan
+ public const string UpdateSource = "VersionUpdate.ResourceUpdateSource";
public const string MirrorChyanCdk = "VersionUpdate.ResourceUpdateSource.MirrorChyanCdk";
public const string UpdateCheck = "VersionUpdate.UpdateCheck";
public const string UpdateAutoCheck = "VersionUpdate.ScheduledUpdateCheck";
diff --git a/src/MaaWpfGui/Models/ResourceUpdater.cs b/src/MaaWpfGui/Models/ResourceUpdater.cs
index e0cc391027..7172bcf30a 100644
--- a/src/MaaWpfGui/Models/ResourceUpdater.cs
+++ b/src/MaaWpfGui/Models/ResourceUpdater.cs
@@ -654,13 +654,18 @@ namespace MaaWpfGui.Models
return ret;
}
- if (!string.IsNullOrEmpty(SettingsViewModel.VersionUpdateSettings.MirrorChyanCdk))
+ switch (SettingsViewModel.VersionUpdateSettings.UpdateSource)
{
- if (await DownloadFromMirrorChyanAsync(uri))
- {
- SettingsViewModel.VersionUpdateSettings.IsCheckingForUpdates = false;
- return CheckUpdateRetT.OnlyGameResourceUpdated;
- }
+ case "Github":
+ break;
+ case "MirrorChyan":
+ if (await DownloadFromMirrorChyanAsync(uri))
+ {
+ SettingsViewModel.VersionUpdateSettings.IsCheckingForUpdates = false;
+ return CheckUpdateRetT.OnlyGameResourceUpdated;
+ }
+
+ break;
}
SettingsViewModel.VersionUpdateSettings.IsCheckingForUpdates = false;
diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml
index 8848faf120..111a33e9d5 100644
--- a/src/MaaWpfGui/Res/Localizations/en-us.xaml
+++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml
@@ -235,11 +235,12 @@ Please note:
4. Do not share the method to enable nightly updates with non-developer users to avoid unnecessary confusion and risk.
You can cancel this popup by clicking the Settings - About Us - Issue Reporting link. Thank you for your understanding and cooperation!
- Update Version
+ Update Channel
Download via aria2
- Check update
+ Software update
Changelog
Resource update
+ Update Source
Mirror-Chyan
Mirror-chan has detected a resource version update. Please go to 'Settings - Software Update' to configure CDK or update the resource version using the GitHub source
New Version Found
diff --git a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml
index 815b10e1e7..cfec66478f 100644
--- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml
+++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml
@@ -235,11 +235,12 @@
4. 内部テスト版の更新方法を非開発ユーザーに共有しないでください。不要な混乱とリスクを避けるためです。
設定 - About us - フィードバックのリンクをクリックして、このポップアップをキャンセルできます。ご理解とご協力をお願いいたします!
- 更新バージョン
+ 更新チャネル
aria2を使う
- アップデートを確認する
+ ソフト更新
変更履歴
リソース更新
+ 更新ソース
ミラーちゃん
Mirrorちゃんがリソースのバージョン更新を検出しましたが。「設定-ソフトウェア更新」でCDKを設定するか、GitHubのソースを使用してリソースのバージョンを更新してください。
新しいバージョンが見つかりました
diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml
index 7bd7bb67ba..b412ae796c 100644
--- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml
+++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml
@@ -235,11 +235,12 @@
4. 비개발자 사용자에게 개발 버전 업데이트 방법을 공유하지 마세요. 불필요한 혼란과 위험을 피하기 위해서입니다.
설정 - 정보 - 이슈 제보 링크를 클릭하여 이 팝업을 취소할 수 있습니다. 이해와 협조에 감사드립니다!
- 업데이트할 버전
+ 업데이트 채널
aria2로 다운로드
- 지금 업데이트
+ 소프트웨어 업데이트
변경 내역
리소스 업데이트
+ 업데이트 소스
미러짱
Mirror-chan 리소스 버전 업데이트 확인. '설정-소프트웨어 업데이트'로 이동하여 CDK를 구성하거나 GitHub 소스를 사용하여 리소스 버전을 업데이트하세요.
새로운 버전 확인
diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml
index 1ef5dd8b10..337d09a310 100644
--- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml
+++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml
@@ -238,11 +238,12 @@
4. 请勿将更新内测版的方法告知其他非开发用户,以避免对他们造成不必要的困扰和风险。
您可通过点击 设置-关于我们-问题反馈 链接来取消该弹窗,感谢您的理解与配合!
- 更新版本
+ 更新渠道
使用 aria2 进行下载
- 检查更新
+ 软件更新
更新日志
资源更新
+ 更新源
Mirror 酱
Mirror 酱检查到资源版本更新,可前往「设置-软件更新」配置 CDK 或使用 github 源进行资源版本更新
检测到新版本
diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml
index 5df6c2b760..a4fe690134 100644
--- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml
+++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml
@@ -235,11 +235,12 @@
4. 請勿將更新內測版的方法告知其他非開發用戶,以避免對他們造成不必要的困擾和風險。
您可通過點擊 設置-關於我們-問題反饋 鏈接來取消該彈窗,感謝您的理解與配合!
- 更新版本
+ 更新通道
使用 aria2 進行下載
- 檢查更新
+ 軟體更新
更新日誌
資源更新
+ 更新來源
Mirror 醬
Mirror 醬檢查到資源版本更新,可前往「設定-軟體更新」配置 CDK 或使用 github 源進行資源版本更新
檢測到新版本
diff --git a/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs b/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs
index d7a6f89c28..7f2664be73 100644
--- a/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs
+++ b/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs
@@ -784,7 +784,7 @@ public class VersionUpdateViewModel : Screen
if ((SettingsViewModel.VersionUpdateSettings.VersionType is
VersionUpdateSettingsUserControlModel.UpdateVersionType.Beta or
VersionUpdateSettingsUserControlModel.UpdateVersionType.Stable)
- && !string.IsNullOrEmpty(SettingsViewModel.VersionUpdateSettings.MirrorChyanCdk))
+ && SettingsViewModel.VersionUpdateSettings.UpdateSource == "MirrorChyan")
{
try
{
diff --git a/src/MaaWpfGui/ViewModels/UserControl/Settings/VersionUpdateSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/Settings/VersionUpdateSettingsUserControlModel.cs
index c683663f4e..f20ea9ed81 100644
--- a/src/MaaWpfGui/ViewModels/UserControl/Settings/VersionUpdateSettingsUserControlModel.cs
+++ b/src/MaaWpfGui/ViewModels/UserControl/Settings/VersionUpdateSettingsUserControlModel.cs
@@ -212,6 +212,26 @@ public class VersionUpdateSettingsUserControlModel : PropertyChangedBase
private bool _updateCheck = Convert.ToBoolean(ConfigurationHelper.GetGlobalValue(ConfigurationKeys.UpdateCheck, bool.TrueString));
+ public List> UpdateSourceList { get; } = [
+ new() { Display = "Github", Value = "Github" },
+ new() { Display = LocalizationHelper.GetString("MirrorChyan"), Value = "MirrorChyan" },
+ ];
+
+ private string _updateSource = ConfigurationHelper.GetGlobalValue(ConfigurationKeys.UpdateSource, "Github");
+
+ ///
+ /// Gets or sets the type of version to update.
+ ///
+ public string UpdateSource
+ {
+ get => _updateSource;
+ set
+ {
+ SetAndNotify(ref _updateSource, value);
+ ConfigurationHelper.SetGlobalValue(ConfigurationKeys.UpdateSource, value);
+ }
+ }
+
private string _mirrorChyanCdk = SimpleEncryptionHelper.Decrypt(ConfigurationHelper.GetGlobalValue(ConfigurationKeys.MirrorChyanCdk, string.Empty));
public string MirrorChyanCdk
@@ -394,9 +414,12 @@ public class VersionUpdateSettingsUserControlModel : PropertyChangedBase
{
IsCheckingForUpdates = true;
- var success = string.IsNullOrEmpty(MirrorChyanCdk)
- ? await ResourceUpdater.UpdateFromGithubAsync()
- : await ResourceUpdater.UpdateFromMirrorChyanAsync();
+ bool success = UpdateSource switch
+ {
+ "Github" => await ResourceUpdater.UpdateFromGithubAsync(),
+ "MirrorChyan" => await ResourceUpdater.UpdateFromMirrorChyanAsync(),
+ _ => await ResourceUpdater.UpdateFromGithubAsync(),
+ };
if (success)
{
diff --git a/src/MaaWpfGui/Views/UserControl/Settings/VersionUpdateSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/Settings/VersionUpdateSettingsUserControl.xaml
index b97f17259d..be760b0474 100644
--- a/src/MaaWpfGui/Views/UserControl/Settings/VersionUpdateSettingsUserControl.xaml
+++ b/src/MaaWpfGui/Views/UserControl/Settings/VersionUpdateSettingsUserControl.xaml
@@ -74,11 +74,22 @@
SelectedValue="{Binding VersionType}"
SelectedValuePath="Value" />
+