diff --git a/src/MaaWpfGui/Constants/ConfigurationKeys.cs b/src/MaaWpfGui/Constants/ConfigurationKeys.cs index d80e117326..654dfde76b 100644 --- a/src/MaaWpfGui/Constants/ConfigurationKeys.cs +++ b/src/MaaWpfGui/Constants/ConfigurationKeys.cs @@ -196,7 +196,9 @@ namespace MaaWpfGui.Constants public const string UpdateProxy = "VersionUpdate.Proxy"; public const string ProxyType = "VersionUpdate.ProxyType"; public const string VersionType = "VersionUpdate.VersionType"; - public const string ResourceUpdateSource = "VersionUpdate.ResourceUpdateSource"; + + // public const string ResourceUpdateSource = "VersionUpdate.ResourceUpdateSource"; + // MirrorChyanCdk 迁到新配置的话就不用加 ResourceUpdateSource 了,现在本体更新也加上了 MirrorChyan 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 52d1081fee..e0cc391027 100644 --- a/src/MaaWpfGui/Models/ResourceUpdater.cs +++ b/src/MaaWpfGui/Models/ResourceUpdater.cs @@ -654,19 +654,13 @@ namespace MaaWpfGui.Models return ret; } - switch (SettingsViewModel.VersionUpdateSettings.ResourceUpdateSource) + if (!string.IsNullOrEmpty(SettingsViewModel.VersionUpdateSettings.MirrorChyanCdk)) { - case "Github": - break; - - case "MirrorChyan": - if (await DownloadFromMirrorChyanAsync(uri)) - { - SettingsViewModel.VersionUpdateSettings.IsCheckingForUpdates = false; - return CheckUpdateRetT.OnlyGameResourceUpdated; - } - - break; + if (await DownloadFromMirrorChyanAsync(uri)) + { + SettingsViewModel.VersionUpdateSettings.IsCheckingForUpdates = false; + return CheckUpdateRetT.OnlyGameResourceUpdated; + } } SettingsViewModel.VersionUpdateSettings.IsCheckingForUpdates = false; diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml index fca7bb995e..8848faf120 100644 --- a/src/MaaWpfGui/Res/Localizations/en-us.xaml +++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml @@ -240,7 +240,6 @@ You can cancel this popup by clicking the Settings - About Us - Issue Reporting Check update Changelog Resource update - Resource 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 fb0d01e25d..815b10e1e7 100644 --- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml +++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml @@ -240,7 +240,6 @@ アップデートを確認する 変更履歴 リソース更新 - リソース更新ソース ミラーちゃん Mirrorちゃんがリソースのバージョン更新を検出しましたが。「設定-ソフトウェア更新」でCDKを設定するか、GitHubのソースを使用してリソースのバージョンを更新してください。 新しいバージョンが見つかりました diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml index f11ebc344e..7bd7bb67ba 100644 --- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml +++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml @@ -240,7 +240,6 @@ 지금 업데이트 변경 내역 리소스 업데이트 - 리소스 업데이트 소스 미러짱 Mirror-chan 리소스 버전 업데이트 확인. '설정-소프트웨어 업데이트'로 이동하여 CDK를 구성하거나 GitHub 소스를 사용하여 리소스 버전을 업데이트하세요. 새로운 버전 확인 diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml index 9bc2f7848b..1ef5dd8b10 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml @@ -243,7 +243,6 @@ 检查更新 更新日志 资源更新 - 资源更新更新源 Mirror 酱 Mirror 酱检查到资源版本更新,可前往「设置-软件更新」配置 CDK 或使用 github 源进行资源版本更新 检测到新版本 diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml index f4e5b2ed7b..5df6c2b760 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml @@ -240,7 +240,6 @@ 檢查更新 更新日誌 資源更新 - 資源更新來源 Mirror 醬 Mirror 醬檢查到資源版本更新,可前往「設定-軟體更新」配置 CDK 或使用 github 源進行資源版本更新 檢測到新版本 diff --git a/src/MaaWpfGui/ViewModels/UserControl/Settings/VersionUpdateSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/Settings/VersionUpdateSettingsUserControlModel.cs index 6fd11a95e4..c683663f4e 100644 --- a/src/MaaWpfGui/ViewModels/UserControl/Settings/VersionUpdateSettingsUserControlModel.cs +++ b/src/MaaWpfGui/ViewModels/UserControl/Settings/VersionUpdateSettingsUserControlModel.cs @@ -212,26 +212,6 @@ public class VersionUpdateSettingsUserControlModel : PropertyChangedBase private bool _updateCheck = Convert.ToBoolean(ConfigurationHelper.GetGlobalValue(ConfigurationKeys.UpdateCheck, bool.TrueString)); - public List> ResourceUpdateSourceList { get; } = [ - new() { Display = "Github", Value = "Github" }, - new() { Display = LocalizationHelper.GetString("MirrorChyan"), Value = "MirrorChyan" }, - ]; - - private string _resourceUpdateSource = ConfigurationHelper.GetGlobalValue(ConfigurationKeys.ResourceUpdateSource, "Github"); - - /// - /// Gets or sets the type of version to update. - /// - public string ResourceUpdateSource - { - get => _resourceUpdateSource; - set - { - SetAndNotify(ref _resourceUpdateSource, value); - ConfigurationHelper.SetGlobalValue(ConfigurationKeys.ResourceUpdateSource, value); - } - } - private string _mirrorChyanCdk = SimpleEncryptionHelper.Decrypt(ConfigurationHelper.GetGlobalValue(ConfigurationKeys.MirrorChyanCdk, string.Empty)); public string MirrorChyanCdk @@ -413,24 +393,10 @@ public class VersionUpdateSettingsUserControlModel : PropertyChangedBase public async Task ManualUpdateResource() { IsCheckingForUpdates = true; - var success = false; - switch (ResourceUpdateSource) - { - case "Github": - if (await ResourceUpdater.UpdateFromGithubAsync()) - { - success = true; - } - break; - case "MirrorChyan": - if (await ResourceUpdater.UpdateFromMirrorChyanAsync()) - { - success = true; - } - - break; - } + var success = string.IsNullOrEmpty(MirrorChyanCdk) + ? await ResourceUpdater.UpdateFromGithubAsync() + : await ResourceUpdater.UpdateFromMirrorChyanAsync(); if (success) { diff --git a/src/MaaWpfGui/Views/UserControl/Settings/VersionUpdateSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/Settings/VersionUpdateSettingsUserControl.xaml index 807a1a9650..2ebb7a2ea6 100644 --- a/src/MaaWpfGui/Views/UserControl/Settings/VersionUpdateSettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/Settings/VersionUpdateSettingsUserControl.xaml @@ -74,26 +74,15 @@ SelectedValue="{Binding VersionType}" SelectedValuePath="Value" /> - + UnsafePassword="{Binding MirrorChyanCdk}" />