refactor: rename Localization class to avoid ambiguity

This commit is contained in:
Liam Sho
2023-03-25 16:26:34 +08:00
parent 258877f615
commit 25e6a814a9
17 changed files with 312 additions and 321 deletions

View File

@@ -40,7 +40,7 @@ namespace MaaWpfGui.Constants
{
get
{
var language = ConfigurationHelper.GetValue(ConfigurationKeys.Localization, Localization.DefaultLanguage);
var language = ConfigurationHelper.GetValue(ConfigurationKeys.Localization, LocalizationHelper.DefaultLanguage);
return $"https://maa.plus/docs/{_helpUrl[language]}";
}
}
@@ -49,7 +49,7 @@ namespace MaaWpfGui.Constants
{
get
{
var language = ConfigurationHelper.GetValue(ConfigurationKeys.Localization, Localization.DefaultLanguage);
var language = ConfigurationHelper.GetValue(ConfigurationKeys.Localization, LocalizationHelper.DefaultLanguage);
return $"https://maa.plus/docs/{_overseasAdaptation[language]}";
}
}

View File

@@ -85,7 +85,7 @@ namespace MaaWpfGui.Extensions
}
// filter items
if (string.IsNullOrEmpty(searchTerm) || searchTerm == Localization.GetString("NotSelected"))
if (string.IsNullOrEmpty(searchTerm) || searchTerm == LocalizationHelper.GetString("NotSelected"))
{
targetComboBox.Items.Filter = item => true;
targetComboBox.SelectedItem = default;

View File

@@ -1,4 +1,4 @@
// <copyright file="Localization.cs" company="MaaAssistantArknights">
// <copyright file="LocalizationHelper.cs" company="MaaAssistantArknights">
// MaaWpfGui - A part of the MaaCoreArknights project
// Copyright (C) 2021 MistEO and Contributors
//
@@ -23,7 +23,7 @@ namespace MaaWpfGui.Helper
/// <summary>
/// The localization class.
/// </summary>
public class Localization
public static class LocalizationHelper
{
/// <summary>
/// The supported languages.

View File

@@ -25,7 +25,7 @@ namespace MaaWpfGui.Helper
{
static Utils()
{
var language = ConfigurationHelper.GetValue(ConfigurationKeys.Localization, Localization.DefaultLanguage);
var language = ConfigurationHelper.GetValue(ConfigurationKeys.Localization, LocalizationHelper.DefaultLanguage);
string filename = string.Empty;
if (language == "zh-cn")
{

View File

@@ -26,7 +26,6 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Stylet;
using StyletIoC;
using Localization = MaaWpfGui.Helper.Localization;
namespace MaaWpfGui.Main
{
@@ -282,7 +281,7 @@ namespace MaaWpfGui.Main
{
Execute.OnUIThread(() =>
{
_windowManager.ShowMessageBox(Localization.GetString("ResourceBroken"), Localization.GetString("Error"), icon: MessageBoxImage.Error);
_windowManager.ShowMessageBox(LocalizationHelper.GetString("ResourceBroken"), LocalizationHelper.GetString("Error"), icon: MessageBoxImage.Error);
Application.Current.Shutdown();
});
}
@@ -376,7 +375,7 @@ namespace MaaWpfGui.Main
break;
case AsstMsg.InitFailed:
_windowManager.ShowMessageBox(Localization.GetString("InitializationError"), Localization.GetString("Error"), icon: MessageBoxImage.Error);
_windowManager.ShowMessageBox(LocalizationHelper.GetString("InitializationError"), LocalizationHelper.GetString("Error"), icon: MessageBoxImage.Error);
Application.Current.Shutdown();
break;
@@ -420,25 +419,25 @@ namespace MaaWpfGui.Main
case "UnsupportedResolution":
connected = false;
_taskQueueViewModel.AddLog(Localization.GetString("ResolutionNotSupported"), UiLogColor.Error);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("ResolutionNotSupported"), UiLogColor.Error);
break;
case "ResolutionError":
connected = false;
_taskQueueViewModel.AddLog(Localization.GetString("ResolutionAcquisitionFailure"), UiLogColor.Error);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("ResolutionAcquisitionFailure"), UiLogColor.Error);
break;
case "Reconnecting":
_taskQueueViewModel.AddLog($"{Localization.GetString("TryToReconnect")}({Convert.ToUInt32(details["details"]["times"]) + 1})", UiLogColor.Error);
_taskQueueViewModel.AddLog($"{LocalizationHelper.GetString("TryToReconnect")}({Convert.ToUInt32(details["details"]["times"]) + 1})", UiLogColor.Error);
break;
case "Reconnected":
_taskQueueViewModel.AddLog(Localization.GetString("ReconnectSuccess"));
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("ReconnectSuccess"));
break;
case "Disconnect":
connected = false;
_taskQueueViewModel.AddLog(Localization.GetString("ReconnectFailed"), UiLogColor.Error);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("ReconnectFailed"), UiLogColor.Error);
if (_taskQueueViewModel.Idle)
{
break;
@@ -450,7 +449,7 @@ namespace MaaWpfGui.Main
{
if (_settingsViewModel.RetryOnDisconnected)
{
_taskQueueViewModel.AddLog(Localization.GetString("TryToStartEmulator"), UiLogColor.Error);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("TryToStartEmulator"), UiLogColor.Error);
_taskQueueViewModel.KillEmulator();
await Task.Delay(3000);
_taskQueueViewModel.Stop();
@@ -462,11 +461,11 @@ namespace MaaWpfGui.Main
break;
case "ScreencapFailed":
_taskQueueViewModel.AddLog(Localization.GetString("ScreencapFailed"), UiLogColor.Error);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("ScreencapFailed"), UiLogColor.Error);
break;
case "TouchModeNotAvaiable":
_taskQueueViewModel.AddLog(Localization.GetString("TouchModeNotAvaiable"), UiLogColor.Error);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("TouchModeNotAvaiable"), UiLogColor.Error);
break;
}
}
@@ -484,7 +483,7 @@ namespace MaaWpfGui.Main
{
if (msg == AsstMsg.TaskChainError)
{
_recruitViewModel.RecruitInfo = Localization.GetString("IdentifyTheMistakes");
_recruitViewModel.RecruitInfo = LocalizationHelper.GetString("IdentifyTheMistakes");
}
}
@@ -502,16 +501,16 @@ namespace MaaWpfGui.Main
break;
case AsstMsg.TaskChainError:
_taskQueueViewModel.AddLog(Localization.GetString("TaskError") + taskChain, UiLogColor.Error);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("TaskError") + taskChain, UiLogColor.Error);
if (isCoplitTaskChain)
{
_copilotViewModel.Idle = true;
_copilotViewModel.AddLog(Localization.GetString("CombatError"), UiLogColor.Error);
_copilotViewModel.AddLog(LocalizationHelper.GetString("CombatError"), UiLogColor.Error);
}
if (taskChain == "Fight" && (_taskQueueViewModel.Stage == "Annihilation"))
{
_taskQueueViewModel.AddLog(Localization.GetString("AnnihilationTaskFailed"), UiLogColor.Warning);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("AnnihilationTaskFailed"), UiLogColor.Warning);
}
break;
@@ -526,7 +525,7 @@ namespace MaaWpfGui.Main
_taskQueueViewModel.InfrastTaskRunning = true;
}
_taskQueueViewModel.AddLog(Localization.GetString("StartTask") + taskChain);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("StartTask") + taskChain);
break;
case AsstMsg.TaskChainCompleted:
@@ -539,15 +538,15 @@ namespace MaaWpfGui.Main
if (_taskQueueViewModel.Stage != string.Empty && _settingsViewModel.CreditFightTaskEnabled)
{
_settingsViewModel.LastCreditFightTaskTime = Utils.GetYJTimeDateString();
_taskQueueViewModel.AddLog(Localization.GetString("CompleteTask") + Localization.GetString("CreditFight"));
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("CompleteTask") + LocalizationHelper.GetString("CreditFight"));
}
}
_taskQueueViewModel.AddLog(Localization.GetString("CompleteTask") + taskChain);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("CompleteTask") + taskChain);
if (isCoplitTaskChain)
{
_copilotViewModel.Idle = true;
_copilotViewModel.AddLog(Localization.GetString("CompleteCombat"), UiLogColor.Info);
_copilotViewModel.AddLog(LocalizationHelper.GetString("CompleteCombat"), UiLogColor.Info);
}
break;
@@ -584,8 +583,8 @@ namespace MaaWpfGui.Main
if (isMainTaskQueueAllCompleted)
{
_taskQueueViewModel.AddLog(Localization.GetString("AllTasksComplete"));
using (var toast = new ToastNotification(Localization.GetString("AllTasksComplete")))
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("AllTasksComplete"));
using (var toast = new ToastNotification(LocalizationHelper.GetString("AllTasksComplete")))
{
toast.Show();
}
@@ -635,29 +634,29 @@ namespace MaaWpfGui.Main
switch (subTask)
{
case "StartGameTask":
_taskQueueViewModel.AddLog(Localization.GetString("FailedToOpenClient"), UiLogColor.Error);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("FailedToOpenClient"), UiLogColor.Error);
break;
case "AutoRecruitTask":
{
var why_str = details.TryGetValue("why", out var why) ? why.ToString() : Localization.GetString("ErrorOccurred");
_taskQueueViewModel.AddLog(why_str + "" + Localization.GetString("HasReturned"), UiLogColor.Error);
var why_str = details.TryGetValue("why", out var why) ? why.ToString() : LocalizationHelper.GetString("ErrorOccurred");
_taskQueueViewModel.AddLog(why_str + "" + LocalizationHelper.GetString("HasReturned"), UiLogColor.Error);
break;
}
case "RecognizeDrops":
_taskQueueViewModel.AddLog(Localization.GetString("DropRecognitionError"), UiLogColor.Error);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("DropRecognitionError"), UiLogColor.Error);
break;
case "ReportToPenguinStats":
{
var why = details["why"].ToString();
_taskQueueViewModel.AddLog(why + "" + Localization.GetString("GiveUpUploadingPenguins"), UiLogColor.Error);
_taskQueueViewModel.AddLog(why + "" + LocalizationHelper.GetString("GiveUpUploadingPenguins"), UiLogColor.Error);
break;
}
case "CheckStageValid":
_taskQueueViewModel.AddLog(Localization.GetString("TheEX"), UiLogColor.Error);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("TheEX"), UiLogColor.Error);
break;
}
}
@@ -675,102 +674,102 @@ namespace MaaWpfGui.Main
{
case "StartButton2":
case "AnnihilationConfirm":
_taskQueueViewModel.AddLog(Localization.GetString("MissionStart") + $" {execTimes} " + Localization.GetString("UnitTime"), UiLogColor.Info);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("MissionStart") + $" {execTimes} " + LocalizationHelper.GetString("UnitTime"), UiLogColor.Info);
break;
case "MedicineConfirm":
_taskQueueViewModel.AddLog(Localization.GetString("MedicineUsed") + $" {execTimes} " + Localization.GetString("UnitTime"), UiLogColor.Info);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("MedicineUsed") + $" {execTimes} " + LocalizationHelper.GetString("UnitTime"), UiLogColor.Info);
break;
case "StoneConfirm":
_taskQueueViewModel.AddLog(Localization.GetString("StoneUsed") + $" {execTimes} " + Localization.GetString("UnitTime"), UiLogColor.Info);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("StoneUsed") + $" {execTimes} " + LocalizationHelper.GetString("UnitTime"), UiLogColor.Info);
break;
case "AbandonAction":
_taskQueueViewModel.AddLog(Localization.GetString("ActingCommandError"), UiLogColor.Error);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("ActingCommandError"), UiLogColor.Error);
break;
case "RecruitRefreshConfirm":
_taskQueueViewModel.AddLog(Localization.GetString("LabelsRefreshed"), UiLogColor.Info);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("LabelsRefreshed"), UiLogColor.Info);
break;
case "RecruitConfirm":
_taskQueueViewModel.AddLog(Localization.GetString("RecruitConfirm"), UiLogColor.Info);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("RecruitConfirm"), UiLogColor.Info);
break;
case "InfrastDormDoubleConfirmButton":
_taskQueueViewModel.AddLog(Localization.GetString("InfrastDormDoubleConfirmed"), UiLogColor.Error);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("InfrastDormDoubleConfirmed"), UiLogColor.Error);
break;
/* 肉鸽相关 */
case "StartExplore":
_taskQueueViewModel.AddLog(Localization.GetString("BegunToExplore") + $" {execTimes} " + Localization.GetString("UnitTime"), UiLogColor.Info);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("BegunToExplore") + $" {execTimes} " + LocalizationHelper.GetString("UnitTime"), UiLogColor.Info);
break;
case "StageTraderInvestConfirm":
_taskQueueViewModel.AddLog(Localization.GetString("HasInvested") + $" {execTimes} " + Localization.GetString("UnitTime"), UiLogColor.Info);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("HasInvested") + $" {execTimes} " + LocalizationHelper.GetString("UnitTime"), UiLogColor.Info);
break;
case "ExitThenAbandon":
_taskQueueViewModel.AddLog(Localization.GetString("ExplorationAbandoned"));
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("ExplorationAbandoned"));
break;
// case "StartAction":
// _taskQueueViewModel.AddLog("开始战斗");
// break;
case "MissionCompletedFlag":
_taskQueueViewModel.AddLog(Localization.GetString("FightCompleted"));
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("FightCompleted"));
break;
case "MissionFailedFlag":
_taskQueueViewModel.AddLog(Localization.GetString("FightFailed"));
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("FightFailed"));
break;
case "StageTraderEnter":
_taskQueueViewModel.AddLog(Localization.GetString("Trader"));
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("Trader"));
break;
case "StageSafeHouseEnter":
_taskQueueViewModel.AddLog(Localization.GetString("SafeHouse"));
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("SafeHouse"));
break;
case "StageEncounterEnter":
_taskQueueViewModel.AddLog(Localization.GetString("Encounter"));
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("Encounter"));
break;
// case "StageBoonsEnter":
// _taskQueueViewModel.AddLog("古堡馈赠");
// break;
case "StageCambatDpsEnter":
_taskQueueViewModel.AddLog(Localization.GetString("CambatDps"));
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("CambatDps"));
break;
case "StageEmergencyDps":
_taskQueueViewModel.AddLog(Localization.GetString("EmergencyDps"));
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("EmergencyDps"));
break;
case "StageDreadfulFoe":
case "StageDreadfulFoe-5Enter":
_taskQueueViewModel.AddLog(Localization.GetString("DreadfulFoe"));
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("DreadfulFoe"));
break;
case "StageTraderInvestSystemFull":
_taskQueueViewModel.AddLog(Localization.GetString("UpperLimit"), UiLogColor.Info);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("UpperLimit"), UiLogColor.Info);
break;
case "RestartGameAndContinue":
_taskQueueViewModel.AddLog(Localization.GetString("GameCrash"), UiLogColor.Warning);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("GameCrash"), UiLogColor.Warning);
break;
case "OfflineConfirm":
if (_settingsViewModel.AutoRestartOnDrop)
{
_taskQueueViewModel.AddLog(Localization.GetString("GameDrop"), UiLogColor.Warning);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("GameDrop"), UiLogColor.Warning);
}
else
{
_taskQueueViewModel.AddLog(Localization.GetString("GameDropNoRestart"), UiLogColor.Warning);
using var toast = new ToastNotification(Localization.GetString("GameDropNoRestart"));
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("GameDropNoRestart"), UiLogColor.Warning);
using var toast = new ToastNotification(LocalizationHelper.GetString("GameDropNoRestart"));
toast.Show();
_taskQueueViewModel.Stop();
}
@@ -778,11 +777,11 @@ namespace MaaWpfGui.Main
break;
case "GamePass":
_taskQueueViewModel.AddLog(Localization.GetString("RoguelikeGamePass"), UiLogColor.RareOperator);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("RoguelikeGamePass"), UiLogColor.RareOperator);
break;
case "BattleStartAll":
_copilotViewModel.AddLog(Localization.GetString("MissionStart"), UiLogColor.Info);
_copilotViewModel.AddLog(LocalizationHelper.GetString("MissionStart"), UiLogColor.Info);
break;
}
}
@@ -829,18 +828,18 @@ namespace MaaWpfGui.Main
all_drops += "\n";
}
all_drops = all_drops.EndsWith("\n") ? all_drops.TrimEnd('\n') : Localization.GetString("NoDrop");
_taskQueueViewModel.AddLog(Localization.GetString("TotalDrop") + "\n" + all_drops);
all_drops = all_drops.EndsWith("\n") ? all_drops.TrimEnd('\n') : LocalizationHelper.GetString("NoDrop");
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("TotalDrop") + "\n" + all_drops);
}
break;
case "EnterFacility":
_taskQueueViewModel.AddLog(Localization.GetString("ThisFacility") + subTaskDetails["facility"] + " " + (int)subTaskDetails["index"]);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("ThisFacility") + subTaskDetails["facility"] + " " + (int)subTaskDetails["index"]);
break;
case "ProductIncorrect":
_taskQueueViewModel.AddLog(Localization.GetString("ProductIncorrect"), UiLogColor.Error);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("ProductIncorrect"), UiLogColor.Error);
break;
case "RecruitTagsDetected":
@@ -853,8 +852,8 @@ namespace MaaWpfGui.Main
log_content += tag_str + "\n";
}
log_content = log_content.EndsWith("\n") ? log_content.TrimEnd('\n') : Localization.GetString("Error");
_taskQueueViewModel.AddLog(Localization.GetString("RecruitingResults") + "\n" + log_content);
log_content = log_content.EndsWith("\n") ? log_content.TrimEnd('\n') : LocalizationHelper.GetString("Error");
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("RecruitingResults") + "\n" + log_content);
}
break;
@@ -867,7 +866,7 @@ namespace MaaWpfGui.Main
break;
}
using var toast = new ToastNotification(Localization.GetString("RecruitingTips"));
using var toast = new ToastNotification(LocalizationHelper.GetString("RecruitingTips"));
toast.AppendContentText(special).ShowRecruit();
}
@@ -876,7 +875,7 @@ namespace MaaWpfGui.Main
case "RecruitRobotTag":
{
string special = subTaskDetails["tag"].ToString();
using var toast = new ToastNotification(Localization.GetString("RecruitingTips"));
using var toast = new ToastNotification(LocalizationHelper.GetString("RecruitingTips"));
toast.AppendContentText(special).ShowRecruitRobot();
}
@@ -887,7 +886,7 @@ namespace MaaWpfGui.Main
int level = (int)subTaskDetails["level"];
if (level >= 5)
{
using (var toast = new ToastNotification(string.Format(Localization.GetString("RecruitmentOfStar"), level)))
using (var toast = new ToastNotification(string.Format(LocalizationHelper.GetString("RecruitmentOfStar"), level)))
{
toast.AppendContentText(new string('★', level)).ShowRecruit(row: 2);
}
@@ -924,9 +923,9 @@ namespace MaaWpfGui.Main
selected_log += tag + "\n";
}
selected_log = selected_log.EndsWith("\n") ? selected_log.TrimEnd('\n') : Localization.GetString("NoDrop");
selected_log = selected_log.EndsWith("\n") ? selected_log.TrimEnd('\n') : LocalizationHelper.GetString("NoDrop");
_taskQueueViewModel.AddLog(Localization.GetString("Choose") + " Tags\n" + selected_log);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("Choose") + " Tags\n" + selected_log);
}
break;
@@ -934,13 +933,13 @@ namespace MaaWpfGui.Main
case "RecruitTagsRefreshed":
{
int refresh_count = (int)subTaskDetails["count"];
_taskQueueViewModel.AddLog(Localization.GetString("Refreshed") + refresh_count + Localization.GetString("UnitTime"));
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("Refreshed") + refresh_count + LocalizationHelper.GetString("UnitTime"));
break;
}
case "NotEnoughStaff":
{
_taskQueueViewModel.AddLog(Localization.GetString("NotEnoughStaff"), UiLogColor.Error);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("NotEnoughStaff"), UiLogColor.Error);
}
break;
@@ -948,14 +947,14 @@ namespace MaaWpfGui.Main
/* Roguelike */
case "StageInfo":
{
_taskQueueViewModel.AddLog(Localization.GetString("StartCombat") + subTaskDetails["name"]);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("StartCombat") + subTaskDetails["name"]);
}
break;
case "StageInfoError":
{
_taskQueueViewModel.AddLog(Localization.GetString("StageInfoError"), UiLogColor.Error);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("StageInfoError"), UiLogColor.Error);
}
break;
@@ -974,11 +973,11 @@ namespace MaaWpfGui.Main
break;
case "BattleFormation":
_copilotViewModel.AddLog(Localization.GetString("BattleFormation") + "\n" + JsonConvert.SerializeObject(subTaskDetails["formation"]));
_copilotViewModel.AddLog(LocalizationHelper.GetString("BattleFormation") + "\n" + JsonConvert.SerializeObject(subTaskDetails["formation"]));
break;
case "BattleFormationSelected":
_copilotViewModel.AddLog(Localization.GetString("BattleFormationSelected") + subTaskDetails["selected"]);
_copilotViewModel.AddLog(LocalizationHelper.GetString("BattleFormationSelected") + subTaskDetails["selected"]);
break;
case "CopilotAction":
@@ -991,7 +990,7 @@ namespace MaaWpfGui.Main
}
_copilotViewModel.AddLog(
string.Format(Localization.GetString("CurrentSteps"),
string.Format(LocalizationHelper.GetString("CurrentSteps"),
subTaskDetails["action"].ToString(),
subTaskDetails["target"].ToString()));
}
@@ -1014,13 +1013,13 @@ namespace MaaWpfGui.Main
case "SSSGamePass":
{
_copilotViewModel.AddLog(Localization.GetString("SSSGamePass"), UiLogColor.RareOperator);
_copilotViewModel.AddLog(LocalizationHelper.GetString("SSSGamePass"), UiLogColor.RareOperator);
}
break;
case "UnsupportedLevel":
_copilotViewModel.AddLog(Localization.GetString("UnsupportedLevel"), UiLogColor.Error);
_copilotViewModel.AddLog(LocalizationHelper.GetString("UnsupportedLevel"), UiLogColor.Error);
break;
case "CustomInfrastRoomOperators":
@@ -1040,15 +1039,15 @@ namespace MaaWpfGui.Main
/* 生息演算 */
case "ReclamationReport":
_taskQueueViewModel.AddLog(Localization.GetString("AlgorithmFinish") + "\n" +
Localization.GetString("AlgorithmBadge") + ": " + $"{(int)subTaskDetails["total_badges"]}(+{(int)subTaskDetails["badges"]})" + "\n" +
Localization.GetString("AlgorithmConstructionPoint") + ": " + $"{(int)subTaskDetails["total_construction_points"]}(+{(int)subTaskDetails["construction_points"]})");
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("AlgorithmFinish") + "\n" +
LocalizationHelper.GetString("AlgorithmBadge") + ": " + $"{(int)subTaskDetails["total_badges"]}(+{(int)subTaskDetails["badges"]})" + "\n" +
LocalizationHelper.GetString("AlgorithmConstructionPoint") + ": " + $"{(int)subTaskDetails["total_construction_points"]}(+{(int)subTaskDetails["construction_points"]})");
break;
case "ReclamationProcedureStart":
_taskQueueViewModel.AddLog(Localization.GetString("MissionStart") + $" {(int)subTaskDetails["times"]} " + Localization.GetString("UnitTime"), UiLogColor.Info);
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("MissionStart") + $" {(int)subTaskDetails["times"]} " + LocalizationHelper.GetString("UnitTime"), UiLogColor.Info);
break;
case "ReclamationSmeltGold":
_taskQueueViewModel.AddLog(Localization.GetString("AlgorithmDoneSmeltGold") + $" {(int)subTaskDetails["times"]} " + Localization.GetString("UnitTime"));
_taskQueueViewModel.AddLog(LocalizationHelper.GetString("AlgorithmDoneSmeltGold") + $" {(int)subTaskDetails["times"]} " + LocalizationHelper.GetString("UnitTime"));
break;
}
}
@@ -1063,7 +1062,7 @@ namespace MaaWpfGui.Main
case "RecruitTagsDetected":
{
JArray tags = (JArray)subTaskDetails["tags"];
string info_content = Localization.GetString("RecruitTagsDetected");
string info_content = LocalizationHelper.GetString("RecruitTagsDetected");
foreach (var tag_name in tags)
{
string tag_str = tag_name.ToString();
@@ -1171,7 +1170,7 @@ namespace MaaWpfGui.Main
}
else
{
error = Localization.GetString("ConnectFailed") + "\n" + Localization.GetString("CheckSettings");
error = LocalizationHelper.GetString("ConnectFailed") + "\n" + LocalizationHelper.GetString("CheckSettings");
}
return ret;

View File

@@ -31,7 +31,6 @@ using Serilog;
using Serilog.Core;
using Stylet;
using StyletIoC;
using Localization = MaaWpfGui.Helper.Localization;
using WindowManager = MaaWpfGui.Helper.WindowManager;
namespace MaaWpfGui.Main
@@ -123,7 +122,7 @@ namespace MaaWpfGui.Main
base.OnStart();
ConfigurationHelper.Load();
Localization.Load();
LocalizationHelper.Load();
}
/// <inheritdoc/>

View File

@@ -66,13 +66,13 @@ namespace MaaWpfGui.Models
public StageInfo(string name, string tipKey, IEnumerable<DayOfWeek> openDays, StageActivityInfo activity)
{
Value = name;
Display = Localization.GetString(name);
Display = LocalizationHelper.GetString(name);
OpenDays = openDays;
Activity = activity;
if (!string.IsNullOrEmpty(tipKey))
{
Tip = Localization.GetString(tipKey);
Tip = LocalizationHelper.GetString(tipKey);
}
}

View File

@@ -18,7 +18,6 @@ using MaaWpfGui.Services.Managers;
using MaaWpfGui.ViewModels;
using MaaWpfGui.ViewModels.UI;
using StyletIoC;
using Localization = MaaWpfGui.Helper.Localization;
namespace MaaWpfGui.Services.HotKeys
{
@@ -72,7 +71,7 @@ namespace MaaWpfGui.Services.HotKeys
return;
}
using var toast = new ToastNotification(Localization.GetString("BackgroundLinkStarted"));
using var toast = new ToastNotification(LocalizationHelper.GetString("BackgroundLinkStarted"));
toast.Show();
}
else
@@ -85,7 +84,7 @@ namespace MaaWpfGui.Services.HotKeys
return;
}
using var toast = new ToastNotification(Localization.GetString("BackgroundLinkStopped"));
using var toast = new ToastNotification(LocalizationHelper.GetString("BackgroundLinkStopped"));
toast.Show();
}
}

View File

@@ -94,7 +94,7 @@ namespace MaaWpfGui.Services
{
// 这里会被 “剩余理智” 复用,第一个必须是 string.Empty 的
// 「当前/上次」关卡导航
{ string.Empty, new StageInfo { Display = Localization.GetString("DefaultStage"), Value = string.Empty } },
{ string.Empty, new StageInfo { Display = LocalizationHelper.GetString("DefaultStage"), Value = string.Empty } },
};
var clientType = ConfigurationHelper.GetValue(ConfigurationKeys.ClientType, string.Empty);
@@ -171,13 +171,13 @@ namespace MaaWpfGui.Services
// &&(!minResourceRequiredParsed || curResourceVersionObj.CompareSortOrderTo(minResourceRequiredObj) < 0)
if (curVersionObj.CompareSortOrderTo(minRequiredObj) < 0)
{
if (!tempStage.ContainsKey(Localization.GetString("UnsupportedStages")))
if (!tempStage.ContainsKey(LocalizationHelper.GetString("UnsupportedStages")))
{
stageInfo = new StageInfo
{
Display = Localization.GetString("UnsupportedStages"),
Value = Localization.GetString("UnsupportedStages"),
Drop = Localization.GetString("LowVersion"),
Display = LocalizationHelper.GetString("UnsupportedStages"),
Value = LocalizationHelper.GetString("UnsupportedStages"),
Drop = LocalizationHelper.GetString("LowVersion"),
Activity = new StageActivityInfo()
{
Tip = stageObj["Activity"]?["Tip"]?.ToString(),
@@ -242,7 +242,7 @@ namespace MaaWpfGui.Services
{ "SK-5", new StageInfo("SK-5", "SKTip", new[] { DayOfWeek.Monday, DayOfWeek.Wednesday, DayOfWeek.Friday, DayOfWeek.Saturday }, resourceCollection) { IsHidden = true } },
// 剿灭模式
{ "Annihilation", new StageInfo { Display = Localization.GetString("Annihilation"), Value = "Annihilation" } },
{ "Annihilation", new StageInfo { Display = LocalizationHelper.GetString("Annihilation"), Value = "Annihilation" } },
// 芯片本
{ "PR-A-1", new StageInfo("PR-A-1", "PR-ATip", new[] { DayOfWeek.Monday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Sunday }, resourceCollection) },
@@ -255,8 +255,8 @@ namespace MaaWpfGui.Services
{ "PR-D-2", new StageInfo("PR-D-2", string.Empty, new[] { DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Saturday, DayOfWeek.Sunday }, resourceCollection) },
// 周一和周日的关卡提示
{ "Pormpt1", new StageInfo { Tip = Localization.GetString("Pormpt1"), OpenDays = new[] { DayOfWeek.Monday }, IsHidden = true } },
{ "Pormpt2", new StageInfo { Tip = Localization.GetString("Pormpt2"), OpenDays = new[] { DayOfWeek.Sunday }, IsHidden = true } },
{ "Pormpt1", new StageInfo { Tip = LocalizationHelper.GetString("Pormpt1"), OpenDays = new[] { DayOfWeek.Monday }, IsHidden = true } },
{ "Pormpt2", new StageInfo { Tip = LocalizationHelper.GetString("Pormpt2"), OpenDays = new[] { DayOfWeek.Sunday }, IsHidden = true } },
})
{
tempStage.Add(kvp.Key, kvp.Value);
@@ -311,8 +311,8 @@ namespace MaaWpfGui.Services
var daysleftopen = (item.Value.Activity.UtcExpireTime - dateTime).Days;
builder.AppendLine(item.Value.Activity.StageName
+ " "
+ Localization.GetString("Daysleftopen")
+ (daysleftopen > 0 ? daysleftopen.ToString() : Localization.GetString("LessThanOneDay")));
+ LocalizationHelper.GetString("Daysleftopen")
+ (daysleftopen > 0 ? daysleftopen.ToString() : LocalizationHelper.GetString("LessThanOneDay")));
sideStoryFlag = false;
}

View File

@@ -50,14 +50,14 @@ namespace MaaWpfGui.Services
_notifyIcon.MouseClick += NotifyIcon_MouseClick;
_notifyIcon.MouseDoubleClick += OnNotifyIconDoubleClick;
MenuItem startMenu = new MenuItem(Localization.GetString("Farming"));
MenuItem startMenu = new MenuItem(LocalizationHelper.GetString("Farming"));
startMenu.Click += StartTask;
MenuItem stopMenu = new MenuItem(Localization.GetString("Stop"));
MenuItem stopMenu = new MenuItem(LocalizationHelper.GetString("Stop"));
stopMenu.Click += StopTask;
MenuItem switchLangMenu = new MenuItem(Localization.GetString("SwitchLanguage"));
MenuItem switchLangMenu = new MenuItem(LocalizationHelper.GetString("SwitchLanguage"));
foreach (var lang in Localization.SupportedLanguages)
foreach (var lang in LocalizationHelper.SupportedLanguages)
{
if (lang.Key == SettingsViewModel.PallasLangKey)
{
@@ -72,7 +72,7 @@ namespace MaaWpfGui.Services
switchLangMenu.MenuItems.Add(langMenu);
}
MenuItem exitMenu = new MenuItem(Localization.GetString("Exit"));
MenuItem exitMenu = new MenuItem(LocalizationHelper.GetString("Exit"));
exitMenu.Click += App_exit;
MenuItem[] menuItems = new MenuItem[] { startMenu, stopMenu, switchLangMenu, exitMenu };
this._notifyIcon.ContextMenu = new ContextMenu(menuItems);

View File

@@ -30,7 +30,6 @@ using Stylet;
using StyletIoC;
using DataFormats = System.Windows.Forms.DataFormats;
using DragEventArgs = System.Windows.DragEventArgs;
using Localization = MaaWpfGui.Helper.Localization;
using Screen = Stylet.Screen;
namespace MaaWpfGui.ViewModels.UI
@@ -60,9 +59,9 @@ namespace MaaWpfGui.ViewModels.UI
{
_container = container;
_windowManager = windowManager;
DisplayName = Localization.GetString("Copilot");
DisplayName = LocalizationHelper.GetString("Copilot");
LogItemViewModels = new ObservableCollection<LogItemViewModel>();
AddLog(Localization.GetString("CopilotTip"), UiLogColor.Message);
AddLog(LocalizationHelper.GetString("CopilotTip"), UiLogColor.Message);
}
protected override void OnInitialActivate()
@@ -187,7 +186,7 @@ namespace MaaWpfGui.ViewModels.UI
}
catch (Exception)
{
AddLog(Localization.GetString("CopilotFileReadError"), UiLogColor.Error);
AddLog(LocalizationHelper.GetString("CopilotFileReadError"), UiLogColor.Error);
return;
}
@@ -242,13 +241,13 @@ namespace MaaWpfGui.ViewModels.UI
}
else
{
AddLog(Localization.GetString("CopilotNoFound"), UiLogColor.Error);
AddLog(LocalizationHelper.GetString("CopilotNoFound"), UiLogColor.Error);
return string.Empty;
}
}
catch (Exception)
{
AddLog(Localization.GetString("NetworkServiceError"), UiLogColor.Error);
AddLog(LocalizationHelper.GetString("NetworkServiceError"), UiLogColor.Error);
return string.Empty;
}
}
@@ -263,7 +262,7 @@ namespace MaaWpfGui.ViewModels.UI
var json = (JObject)JsonConvert.DeserializeObject(jsonStr);
if (json == null)
{
AddLog(Localization.GetString("CopilotJsonError"), UiLogColor.Error);
AddLog(LocalizationHelper.GetString("CopilotJsonError"), UiLogColor.Error);
return;
}
@@ -383,11 +382,11 @@ namespace MaaWpfGui.ViewModels.UI
File.WriteAllText(TempCopilotFile, json.ToString());
}
AddLog(Localization.GetString("CopilotTip"));
AddLog(LocalizationHelper.GetString("CopilotTip"));
}
catch (Exception)
{
AddLog(Localization.GetString("CopilotJsonError"), UiLogColor.Error);
AddLog(LocalizationHelper.GetString("CopilotJsonError"), UiLogColor.Error);
}
}
@@ -433,7 +432,7 @@ namespace MaaWpfGui.ViewModels.UI
{
Filename = string.Empty;
ClearLog();
AddLog(Localization.GetString("NotCopilotJson"), UiLogColor.Error);
AddLog(LocalizationHelper.GetString("NotCopilotJson"), UiLogColor.Error);
}
}
@@ -476,7 +475,7 @@ namespace MaaWpfGui.ViewModels.UI
}*/
Idle = false;
AddLog(Localization.GetString("ConnectingToEmulator"));
AddLog(LocalizationHelper.GetString("ConnectingToEmulator"));
string errMsg = string.Empty;
var task = Task.Run(() =>
@@ -499,16 +498,16 @@ namespace MaaWpfGui.ViewModels.UI
Loop ? LoopTimes : 1);
if (ret)
{
AddLog(Localization.GetString("Running"));
AddLog(LocalizationHelper.GetString("Running"));
if (!_settingsViewModel.AdbReplaced && !_settingsViewModel.IsAdbTouchMode())
{
AddLog(Localization.GetString("AdbReplacementTips"), UiLogColor.Info);
AddLog(LocalizationHelper.GetString("AdbReplacementTips"), UiLogColor.Info);
}
}
else
{
Idle = true;
AddLog(Localization.GetString("CopilotFileReadError"), UiLogColor.Error);
AddLog(LocalizationHelper.GetString("CopilotFileReadError"), UiLogColor.Error);
}
}
@@ -591,17 +590,17 @@ namespace MaaWpfGui.ViewModels.UI
var response = await WebService.PostJsonAsync(_copilotRatingUrl, jsonParam);
if (response == null)
{
AddLog(Localization.GetString("FailedToLikeWebJson"), UiLogColor.Error);
AddLog(LocalizationHelper.GetString("FailedToLikeWebJson"), UiLogColor.Error);
return;
}
_recentlyRatedCopilotId.Add(CopilotId);
AddLog(Localization.GetString("ThanksForLikeWebJson"), UiLogColor.Info);
AddLog(LocalizationHelper.GetString("ThanksForLikeWebJson"), UiLogColor.Info);
}
private readonly string CopilotUiUrl = MaaUrls.PrtsPlus;
private string _url = MaaUrls.PrtsPlus;
private string _urlText = Localization.GetString("PrtsPlus");
private string _urlText = LocalizationHelper.GetString("PrtsPlus");
/// <summary>
/// Gets or sets the UrlText.
@@ -620,7 +619,7 @@ namespace MaaWpfGui.ViewModels.UI
get => _url;
set
{
UrlText = value == CopilotUiUrl ? Localization.GetString("PrtsPlus") : Localization.GetString("VideoLink");
UrlText = value == CopilotUiUrl ? LocalizationHelper.GetString("PrtsPlus") : LocalizationHelper.GetString("VideoLink");
SetAndNotify(ref _url, value);
}
}
@@ -669,7 +668,7 @@ namespace MaaWpfGui.ViewModels.UI
switch (text)
{
case "/help":
AddLog(Localization.GetString("HelloWorld"), UiLogColor.Message);
AddLog(LocalizationHelper.GetString("HelloWorld"), UiLogColor.Message);
break;
}
}

View File

@@ -15,11 +15,11 @@ using System;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using MaaWpfGui.Helper;
using MaaWpfGui.Main;
using Newtonsoft.Json.Linq;
using Stylet;
using StyletIoC;
using Localization = MaaWpfGui.Helper.Localization;
namespace MaaWpfGui.ViewModels.UI
{
@@ -42,7 +42,7 @@ namespace MaaWpfGui.ViewModels.UI
{
_container = container;
_windowManager = windowManager;
DisplayName = Localization.GetString("DepotRecognition");
DisplayName = LocalizationHelper.GetString("DepotRecognition");
}
protected override void OnInitialActivate()
@@ -55,7 +55,7 @@ namespace MaaWpfGui.ViewModels.UI
}));
}
private string _depotInfo = Localization.GetString("DepotRecognitionTip");
private string _depotInfo = LocalizationHelper.GetString("DepotRecognitionTip");
/// <summary>
/// Gets or sets the depot info.
@@ -114,7 +114,7 @@ namespace MaaWpfGui.ViewModels.UI
bool done = (bool)details["done"];
if (done)
{
DepotInfo = Localization.GetString("IdentificationCompleted") + "\n" + Localization.GetString("DepotRecognitionTip");
DepotInfo = LocalizationHelper.GetString("IdentificationCompleted") + "\n" + LocalizationHelper.GetString("DepotRecognitionTip");
Done = true;
}
@@ -138,7 +138,7 @@ namespace MaaWpfGui.ViewModels.UI
public void ExportToArkplanner()
{
Clipboard.SetDataObject(ArkPlannerResult);
DepotInfo = Localization.GetString("CopiedToClipboard");
DepotInfo = LocalizationHelper.GetString("CopiedToClipboard");
}
/// <summary>
@@ -147,7 +147,7 @@ namespace MaaWpfGui.ViewModels.UI
public void ExportToLolicon()
{
Clipboard.SetDataObject(LoliconResult);
DepotInfo = Localization.GetString("CopiedToClipboard");
DepotInfo = LocalizationHelper.GetString("CopiedToClipboard");
}
private void Clear()
@@ -164,7 +164,7 @@ namespace MaaWpfGui.ViewModels.UI
public async void Start()
{
string errMsg = string.Empty;
DepotInfo = Localization.GetString("ConnectingToEmulator");
DepotInfo = LocalizationHelper.GetString("ConnectingToEmulator");
var task = Task.Run(() =>
{
return _asstProxy.AsstConnect(ref errMsg);
@@ -176,7 +176,7 @@ namespace MaaWpfGui.ViewModels.UI
return;
}
DepotInfo = Localization.GetString("Identifying");
DepotInfo = LocalizationHelper.GetString("Identifying");
Clear();
_asstProxy.AsstStartDepot();

View File

@@ -20,7 +20,6 @@ using MaaWpfGui.Helper;
using MaaWpfGui.Main;
using Stylet;
using StyletIoC;
using Localization = MaaWpfGui.Helper.Localization;
namespace MaaWpfGui.ViewModels.UI
{
@@ -43,7 +42,7 @@ namespace MaaWpfGui.ViewModels.UI
{
_container = container;
_windowManager = windowManager;
DisplayName = Localization.GetString("RecruitmentRecognition");
DisplayName = LocalizationHelper.GetString("RecruitmentRecognition");
}
protected override void OnInitialActivate()
@@ -56,7 +55,7 @@ namespace MaaWpfGui.ViewModels.UI
}));
}
private string _recruitInfo = Localization.GetString("RecruitmentRecognitionTip");
private string _recruitInfo = LocalizationHelper.GetString("RecruitmentRecognitionTip");
/// <summary>
/// Gets or sets the recruit info.
@@ -176,7 +175,7 @@ namespace MaaWpfGui.ViewModels.UI
public async void StartCalc()
{
string errMsg = string.Empty;
RecruitInfo = Localization.GetString("ConnectingToEmulator");
RecruitInfo = LocalizationHelper.GetString("ConnectingToEmulator");
var task = Task.Run(() =>
{
return _asstProxy.AsstConnect(ref errMsg);
@@ -188,7 +187,7 @@ namespace MaaWpfGui.ViewModels.UI
return;
}
RecruitInfo = Localization.GetString("Identifying");
RecruitInfo = LocalizationHelper.GetString("Identifying");
RecruitResult = string.Empty;
var levelList = new List<int>();

View File

@@ -36,7 +36,6 @@ using MaaWpfGui.Utilities.ValueType;
using Newtonsoft.Json;
using Stylet;
using StyletIoC;
using Localization = MaaWpfGui.Helper.Localization;
namespace MaaWpfGui.ViewModels.UI
{
@@ -71,7 +70,7 @@ namespace MaaWpfGui.ViewModels.UI
/// </summary>
public string VersionId => s_versionId;
private static readonly string s_versionInfo = Localization.GetString("Version") + ": " + s_versionId;
private static readonly string s_versionInfo = LocalizationHelper.GetString("Version") + ": " + s_versionId;
/// <summary>
/// Gets the version info.
@@ -93,20 +92,20 @@ namespace MaaWpfGui.ViewModels.UI
_container = container;
_windowManager = windowManager;
DisplayName = Localization.GetString("Settings");
_listTitle.Add(Localization.GetString("GameSettings"));
_listTitle.Add(Localization.GetString("BaseSettings"));
_listTitle.Add(Localization.GetString("RoguelikeSettings"));
_listTitle.Add(Localization.GetString("RecruitingSettings"));
_listTitle.Add(Localization.GetString("MallSettings"));
_listTitle.Add(Localization.GetString("OtherCombatSettings"));
_listTitle.Add(Localization.GetString("ConnectionSettings"));
_listTitle.Add(Localization.GetString("StartupSettings"));
_listTitle.Add(Localization.GetString("ScheduleSettings"));
_listTitle.Add(Localization.GetString("UISettings"));
_listTitle.Add(Localization.GetString("HotKeySettings"));
_listTitle.Add(Localization.GetString("UpdateSettings"));
_listTitle.Add(Localization.GetString("AboutUs"));
DisplayName = LocalizationHelper.GetString("Settings");
_listTitle.Add(LocalizationHelper.GetString("GameSettings"));
_listTitle.Add(LocalizationHelper.GetString("BaseSettings"));
_listTitle.Add(LocalizationHelper.GetString("RoguelikeSettings"));
_listTitle.Add(LocalizationHelper.GetString("RecruitingSettings"));
_listTitle.Add(LocalizationHelper.GetString("MallSettings"));
_listTitle.Add(LocalizationHelper.GetString("OtherCombatSettings"));
_listTitle.Add(LocalizationHelper.GetString("ConnectionSettings"));
_listTitle.Add(LocalizationHelper.GetString("StartupSettings"));
_listTitle.Add(LocalizationHelper.GetString("ScheduleSettings"));
_listTitle.Add(LocalizationHelper.GetString("UISettings"));
_listTitle.Add(LocalizationHelper.GetString("HotKeySettings"));
_listTitle.Add(LocalizationHelper.GetString("UpdateSettings"));
_listTitle.Add(LocalizationHelper.GetString("AboutUs"));
InfrastInit();
@@ -114,8 +113,8 @@ namespace MaaWpfGui.ViewModels.UI
{
Hangover = false;
_windowManager.ShowMessageBox(
Localization.GetString("Hangover"),
Localization.GetString("Burping"),
LocalizationHelper.GetString("Hangover"),
LocalizationHelper.GetString("Burping"),
MessageBoxButton.OK, MessageBoxImage.Hand);
Application.Current.Shutdown();
System.Windows.Forms.Application.Restart();
@@ -186,11 +185,11 @@ namespace MaaWpfGui.ViewModels.UI
if (!parsed || order < 0)
{
temp_order_list[i] = new DragItemViewModel(Localization.GetString(facility), facility, "Infrast.");
temp_order_list[i] = new DragItemViewModel(LocalizationHelper.GetString(facility), facility, "Infrast.");
}
else
{
temp_order_list[order] = new DragItemViewModel(Localization.GetString(facility), facility, "Infrast.");
temp_order_list[order] = new DragItemViewModel(LocalizationHelper.GetString(facility), facility, "Infrast.");
}
}
@@ -198,51 +197,51 @@ namespace MaaWpfGui.ViewModels.UI
DefaultInfrastList = new List<CombinedData>
{
new CombinedData { Display = Localization.GetString("UserDefined"), Value = _userDefined },
new CombinedData { Display = Localization.GetString("153_3"), Value = "153_layout_3_times_a_day.json" },
new CombinedData { Display = Localization.GetString("243_3"), Value = "243_layout_3_times_a_day.json" },
new CombinedData { Display = Localization.GetString("243_4"), Value = "243_layout_4_times_a_day.json" },
new CombinedData { Display = Localization.GetString("252_3"), Value = "252_layout_3_times_a_day.json" },
new CombinedData { Display = Localization.GetString("333_3"), Value = "333_layout_for_Orundum_3_times_a_day.json" },
new CombinedData { Display = LocalizationHelper.GetString("UserDefined"), Value = _userDefined },
new CombinedData { Display = LocalizationHelper.GetString("153_3"), Value = "153_layout_3_times_a_day.json" },
new CombinedData { Display = LocalizationHelper.GetString("243_3"), Value = "243_layout_3_times_a_day.json" },
new CombinedData { Display = LocalizationHelper.GetString("243_4"), Value = "243_layout_4_times_a_day.json" },
new CombinedData { Display = LocalizationHelper.GetString("252_3"), Value = "252_layout_3_times_a_day.json" },
new CombinedData { Display = LocalizationHelper.GetString("333_3"), Value = "333_layout_for_Orundum_3_times_a_day.json" },
};
UsesOfDronesList = new List<CombinedData>
{
new CombinedData { Display = Localization.GetString("DronesNotUse"), Value = "_NotUse" },
new CombinedData { Display = Localization.GetString("Money"), Value = "Money" },
new CombinedData { Display = Localization.GetString("SyntheticJade"), Value = "SyntheticJade" },
new CombinedData { Display = Localization.GetString("CombatRecord"), Value = "CombatRecord" },
new CombinedData { Display = Localization.GetString("PureGold"), Value = "PureGold" },
new CombinedData { Display = Localization.GetString("OriginStone"), Value = "OriginStone" },
new CombinedData { Display = Localization.GetString("Chip"), Value = "Chip" },
new CombinedData { Display = LocalizationHelper.GetString("DronesNotUse"), Value = "_NotUse" },
new CombinedData { Display = LocalizationHelper.GetString("Money"), Value = "Money" },
new CombinedData { Display = LocalizationHelper.GetString("SyntheticJade"), Value = "SyntheticJade" },
new CombinedData { Display = LocalizationHelper.GetString("CombatRecord"), Value = "CombatRecord" },
new CombinedData { Display = LocalizationHelper.GetString("PureGold"), Value = "PureGold" },
new CombinedData { Display = LocalizationHelper.GetString("OriginStone"), Value = "OriginStone" },
new CombinedData { Display = LocalizationHelper.GetString("Chip"), Value = "Chip" },
};
ConnectConfigList = new List<CombinedData>
{
new CombinedData { Display = Localization.GetString("General"), Value = "General" },
new CombinedData { Display = Localization.GetString("BlueStacks"), Value = "BlueStacks" },
new CombinedData { Display = Localization.GetString("MuMuEmulator"), Value = "MuMuEmulator" },
new CombinedData { Display = Localization.GetString("LDPlayer"), Value = "LDPlayer" },
new CombinedData { Display = Localization.GetString("Nox"), Value = "Nox" },
new CombinedData { Display = Localization.GetString("XYAZ"), Value = "XYAZ" },
new CombinedData { Display = Localization.GetString("WSA"), Value = "WSA" },
new CombinedData { Display = Localization.GetString("Compatible"), Value = "Compatible" },
new CombinedData { Display = Localization.GetString("GeneralWithoutScreencapErr"), Value = "GeneralWithoutScreencapErr" },
new CombinedData { Display = LocalizationHelper.GetString("General"), Value = "General" },
new CombinedData { Display = LocalizationHelper.GetString("BlueStacks"), Value = "BlueStacks" },
new CombinedData { Display = LocalizationHelper.GetString("MuMuEmulator"), Value = "MuMuEmulator" },
new CombinedData { Display = LocalizationHelper.GetString("LDPlayer"), Value = "LDPlayer" },
new CombinedData { Display = LocalizationHelper.GetString("Nox"), Value = "Nox" },
new CombinedData { Display = LocalizationHelper.GetString("XYAZ"), Value = "XYAZ" },
new CombinedData { Display = LocalizationHelper.GetString("WSA"), Value = "WSA" },
new CombinedData { Display = LocalizationHelper.GetString("Compatible"), Value = "Compatible" },
new CombinedData { Display = LocalizationHelper.GetString("GeneralWithoutScreencapErr"), Value = "GeneralWithoutScreencapErr" },
};
TouchModeList = new List<CombinedData>
{
new CombinedData { Display = Localization.GetString("MiniTouchMode"), Value = "minitouch" },
new CombinedData { Display = Localization.GetString("MaaTouchMode"), Value = "maatouch" },
new CombinedData { Display = Localization.GetString("AdbTouchMode"), Value = "adb" },
new CombinedData { Display = LocalizationHelper.GetString("MiniTouchMode"), Value = "minitouch" },
new CombinedData { Display = LocalizationHelper.GetString("MaaTouchMode"), Value = "maatouch" },
new CombinedData { Display = LocalizationHelper.GetString("AdbTouchMode"), Value = "adb" },
};
_dormThresholdLabel = Localization.GetString("DormThreshold") + ": " + _dormThreshold + "%";
_dormThresholdLabel = LocalizationHelper.GetString("DormThreshold") + ": " + _dormThreshold + "%";
RoguelikeModeList = new List<CombinedData>
{
new CombinedData { Display = Localization.GetString("RoguelikeStrategyExp"), Value = "0" },
new CombinedData { Display = Localization.GetString("RoguelikeStrategyGold"), Value = "1" },
new CombinedData { Display = LocalizationHelper.GetString("RoguelikeStrategyExp"), Value = "0" },
new CombinedData { Display = LocalizationHelper.GetString("RoguelikeStrategyGold"), Value = "1" },
// new CombData { Display = "两者兼顾,投资过后退出", Value = "2" } // 弃用
// new CombData { Display = Localization.GetString("3"), Value = "3" }, // 开发中
@@ -250,48 +249,48 @@ namespace MaaWpfGui.ViewModels.UI
RoguelikeThemeList = new List<CombinedData>
{
new CombinedData { Display = Localization.GetString("RoguelikeThemePhantom"), Value = "Phantom" },
new CombinedData { Display = Localization.GetString("RoguelikeThemeMizuki"), Value = "Mizuki" },
new CombinedData { Display = LocalizationHelper.GetString("RoguelikeThemePhantom"), Value = "Phantom" },
new CombinedData { Display = LocalizationHelper.GetString("RoguelikeThemeMizuki"), Value = "Mizuki" },
};
UpdateRoguelikeThemeList();
RoguelikeRolesList = new List<CombinedData>
{
new CombinedData { Display = Localization.GetString("DefaultRoles"), Value = string.Empty },
new CombinedData { Display = Localization.GetString("FirstMoveAdvantage"), Value = "先手必胜" },
new CombinedData { Display = Localization.GetString("SlowAndSteadyWinsTheRace"), Value = "稳扎稳打" },
new CombinedData { Display = Localization.GetString("OvercomingYourWeaknesses"), Value = "取长补短" },
new CombinedData { Display = Localization.GetString("AsYourHeartDesires"), Value = "随心所欲" },
new CombinedData { Display = LocalizationHelper.GetString("DefaultRoles"), Value = string.Empty },
new CombinedData { Display = LocalizationHelper.GetString("FirstMoveAdvantage"), Value = "先手必胜" },
new CombinedData { Display = LocalizationHelper.GetString("SlowAndSteadyWinsTheRace"), Value = "稳扎稳打" },
new CombinedData { Display = LocalizationHelper.GetString("OvercomingYourWeaknesses"), Value = "取长补短" },
new CombinedData { Display = LocalizationHelper.GetString("AsYourHeartDesires"), Value = "随心所欲" },
};
ClientTypeList = new List<CombinedData>
{
new CombinedData { Display = Localization.GetString("NotSelected"), Value = string.Empty },
new CombinedData { Display = Localization.GetString("Official"), Value = "Official" },
new CombinedData { Display = Localization.GetString("Bilibili"), Value = "Bilibili" },
new CombinedData { Display = Localization.GetString("YoStarEN"), Value = "YoStarEN" },
new CombinedData { Display = Localization.GetString("YoStarJP"), Value = "YoStarJP" },
new CombinedData { Display = Localization.GetString("YoStarKR"), Value = "YoStarKR" },
new CombinedData { Display = Localization.GetString("txwy"), Value = "txwy" },
new CombinedData { Display = LocalizationHelper.GetString("NotSelected"), Value = string.Empty },
new CombinedData { Display = LocalizationHelper.GetString("Official"), Value = "Official" },
new CombinedData { Display = LocalizationHelper.GetString("Bilibili"), Value = "Bilibili" },
new CombinedData { Display = LocalizationHelper.GetString("YoStarEN"), Value = "YoStarEN" },
new CombinedData { Display = LocalizationHelper.GetString("YoStarJP"), Value = "YoStarJP" },
new CombinedData { Display = LocalizationHelper.GetString("YoStarKR"), Value = "YoStarKR" },
new CombinedData { Display = LocalizationHelper.GetString("txwy"), Value = "txwy" },
};
InverseClearModeList = new List<CombinedData>
{
new CombinedData { Display = Localization.GetString("Clear"), Value = "Clear" },
new CombinedData { Display = Localization.GetString("Inverse"), Value = "Inverse" },
new CombinedData { Display = Localization.GetString("Switchable"), Value = "ClearInverse" },
new CombinedData { Display = LocalizationHelper.GetString("Clear"), Value = "Clear" },
new CombinedData { Display = LocalizationHelper.GetString("Inverse"), Value = "Inverse" },
new CombinedData { Display = LocalizationHelper.GetString("Switchable"), Value = "ClearInverse" },
};
VersionTypeList = new List<GenericCombinedData<UpdateVersionType>>
{
new GenericCombinedData<UpdateVersionType> { Display = Localization.GetString("UpdateCheckNightly"), Value = UpdateVersionType.Nightly },
new GenericCombinedData<UpdateVersionType> { Display = Localization.GetString("UpdateCheckBeta"), Value = UpdateVersionType.Beta },
new GenericCombinedData<UpdateVersionType> { Display = Localization.GetString("UpdateCheckStable"), Value = UpdateVersionType.Stable },
new GenericCombinedData<UpdateVersionType> { Display = LocalizationHelper.GetString("UpdateCheckNightly"), Value = UpdateVersionType.Nightly },
new GenericCombinedData<UpdateVersionType> { Display = LocalizationHelper.GetString("UpdateCheckBeta"), Value = UpdateVersionType.Beta },
new GenericCombinedData<UpdateVersionType> { Display = LocalizationHelper.GetString("UpdateCheckStable"), Value = UpdateVersionType.Stable },
};
LanguageList = new List<CombinedData>();
foreach (var pair in Localization.SupportedLanguages)
foreach (var pair in LocalizationHelper.SupportedLanguages)
{
if (pair.Key == PallasLangKey && !Cheers)
{
@@ -598,7 +597,7 @@ namespace MaaWpfGui.ViewModels.UI
{
var dialog = new Microsoft.Win32.OpenFileDialog
{
Filter = Localization.GetString("Executable") + "|*.exe;*.bat;*.lnk",
Filter = LocalizationHelper.GetString("Executable") + "|*.exe;*.bat;*.lnk",
};
if (dialog.ShowDialog() == true)
@@ -759,7 +758,7 @@ namespace MaaWpfGui.ViewModels.UI
set
{
SetAndNotify(ref _dormThreshold, value);
DormThresholdLabel = Localization.GetString("DormThreshold") + ": " + _dormThreshold + "%";
DormThresholdLabel = LocalizationHelper.GetString("DormThreshold") + ": " + _dormThreshold + "%";
ConfigurationHelper.SetValue(ConfigurationKeys.DormThreshold, value.ToString());
}
}
@@ -930,7 +929,7 @@ namespace MaaWpfGui.ViewModels.UI
{
var dialog = new Microsoft.Win32.OpenFileDialog
{
Filter = Localization.GetString("CustomInfrastFile") + "|*.json",
Filter = LocalizationHelper.GetString("CustomInfrastFile") + "|*.json",
};
if (dialog.ShowDialog() == true)
@@ -1332,7 +1331,7 @@ namespace MaaWpfGui.ViewModels.UI
}
}
private string _creditFirstList = ConfigurationHelper.GetValue(ConfigurationKeys.CreditFirstListNew, Localization.GetString("HighPriorityDefault"));
private string _creditFirstList = ConfigurationHelper.GetValue(ConfigurationKeys.CreditFirstListNew, LocalizationHelper.GetString("HighPriorityDefault"));
/// <summary>
/// Gets or sets the priority item list of credit shop.
@@ -1347,7 +1346,7 @@ namespace MaaWpfGui.ViewModels.UI
}
}
private string _creditBlackList = ConfigurationHelper.GetValue(ConfigurationKeys.CreditBlackListNew, Localization.GetString("BlacklistDefault"));
private string _creditBlackList = ConfigurationHelper.GetValue(ConfigurationKeys.CreditBlackListNew, LocalizationHelper.GetString("BlacklistDefault"));
/// <summary>
/// Gets or sets the blacklist of credit shop.
@@ -1760,19 +1759,19 @@ namespace MaaWpfGui.ViewModels.UI
break;
case VersionUpdateViewModel.CheckUpdateRetT.AlreadyLatest:
toastMessage = Localization.GetString("AlreadyLatest");
toastMessage = LocalizationHelper.GetString("AlreadyLatest");
break;
case VersionUpdateViewModel.CheckUpdateRetT.UnknownError:
toastMessage = Localization.GetString("NewVersionDetectFailedTitle");
toastMessage = LocalizationHelper.GetString("NewVersionDetectFailedTitle");
break;
case VersionUpdateViewModel.CheckUpdateRetT.NetworkError:
toastMessage = Localization.GetString("CheckNetworking");
toastMessage = LocalizationHelper.GetString("CheckNetworking");
break;
case VersionUpdateViewModel.CheckUpdateRetT.FailedToGetInfo:
toastMessage = Localization.GetString("GetReleaseNoteFailed");
toastMessage = LocalizationHelper.GetString("GetReleaseNoteFailed");
break;
case VersionUpdateViewModel.CheckUpdateRetT.OK:
@@ -1780,7 +1779,7 @@ namespace MaaWpfGui.ViewModels.UI
break;
case VersionUpdateViewModel.CheckUpdateRetT.NewVersionIsBeingBuilt:
toastMessage = Localization.GetString("NewVersionIsBeingBuilt");
toastMessage = LocalizationHelper.GetString("NewVersionIsBeingBuilt");
break;
}
@@ -1981,18 +1980,18 @@ namespace MaaWpfGui.ViewModels.UI
}
catch (Exception)
{
error = Localization.GetString("EmulatorException");
error = LocalizationHelper.GetString("EmulatorException");
return false;
}
if (emulators.Count == 0)
{
error = Localization.GetString("EmulatorNotFound");
error = LocalizationHelper.GetString("EmulatorNotFound");
return false;
}
else if (emulators.Count > 1)
{
error = Localization.GetString("EmulatorTooMany");
error = LocalizationHelper.GetString("EmulatorTooMany");
return false;
}
@@ -2000,7 +1999,7 @@ namespace MaaWpfGui.ViewModels.UI
AdbPath = adapter.GetAdbPathByEmulatorName(ConnectConfig) ?? AdbPath;
if (string.IsNullOrEmpty(AdbPath))
{
error = Localization.GetString("AdbException");
error = LocalizationHelper.GetString("AdbException");
return false;
}
@@ -2043,7 +2042,7 @@ namespace MaaWpfGui.ViewModels.UI
{
var dialog = new Microsoft.Win32.OpenFileDialog
{
Filter = Localization.GetString("ADBProgram") + "|*.exe",
Filter = LocalizationHelper.GetString("ADBProgram") + "|*.exe",
};
if (dialog.ShowDialog() == true)
@@ -2140,7 +2139,7 @@ namespace MaaWpfGui.ViewModels.UI
{
Execute.OnUIThread(() =>
{
using var toast = new ToastNotification(Localization.GetString("ReplaceADBNotExists"));
using var toast = new ToastNotification(LocalizationHelper.GetString("ReplaceADBNotExists"));
toast.Show();
});
return;
@@ -2157,8 +2156,8 @@ namespace MaaWpfGui.ViewModels.UI
{
Execute.OnUIThread(() =>
{
using var toast = new ToastNotification(Localization.GetString("AdbDownloadFailedTitle"));
toast.AppendContentText(Localization.GetString("AdbDownloadFailedDesc")).Show();
using var toast = new ToastNotification(LocalizationHelper.GetString("AdbDownloadFailedTitle"));
toast.AppendContentText(LocalizationHelper.GetString("AdbDownloadFailedDesc")).Show();
});
return;
}
@@ -2190,7 +2189,7 @@ namespace MaaWpfGui.ViewModels.UI
ConfigurationHelper.SetValue(ConfigurationKeys.AdbReplaced, true.ToString());
Execute.OnUIThread(() =>
{
using var toast = new ToastNotification(Localization.GetString("SuccessfullyReplacedADB"));
using var toast = new ToastNotification(LocalizationHelper.GetString("SuccessfullyReplacedADB"));
toast.Show();
});
}
@@ -2254,16 +2253,16 @@ namespace MaaWpfGui.ViewModels.UI
ConfigurationHelper.SetValue(ConfigurationKeys.SetColors, value.ToString());
MessageBoxHelper.Unregister();
MessageBoxHelper.Yes = Localization.GetString("Ok");
MessageBoxHelper.No = Localization.GetString("ManualRestart");
MessageBoxHelper.Yes = LocalizationHelper.GetString("Ok");
MessageBoxHelper.No = LocalizationHelper.GetString("ManualRestart");
MessageBoxHelper.Register();
Window mainWindow = Application.Current.MainWindow;
mainWindow!.Show();
mainWindow.WindowState = mainWindow.WindowState = WindowState.Normal;
mainWindow.Activate();
var result = MessageBox.Show(
Localization.GetString("DarkModeSetColorsTip"),
Localization.GetString("Tip"),
LocalizationHelper.GetString("DarkModeSetColorsTip"),
LocalizationHelper.GetString("Tip"),
MessageBoxButton.YesNo,
MessageBoxImage.Question);
MessageBoxHelper.Unregister();
@@ -2485,7 +2484,7 @@ namespace MaaWpfGui.ViewModels.UI
}
}
private string _soberLanguage = ConfigurationHelper.GetValue("GUI.SoberLanguage", Localization.DefaultLanguage);
private string _soberLanguage = ConfigurationHelper.GetValue("GUI.SoberLanguage", LocalizationHelper.DefaultLanguage);
public string SoberLanguage
{
@@ -2497,7 +2496,7 @@ namespace MaaWpfGui.ViewModels.UI
}
}
private string _language = ConfigurationHelper.GetValue(ConfigurationKeys.Localization, Localization.DefaultLanguage);
private string _language = ConfigurationHelper.GetValue(ConfigurationKeys.Localization, LocalizationHelper.DefaultLanguage);
/// <summary>
/// Gets or sets the language.
@@ -2527,7 +2526,7 @@ namespace MaaWpfGui.ViewModels.UI
ConfigurationHelper.SetValue(ConfigurationKeys.Localization, value);
string FormatText(string text, string key)
=> string.Format(text, Localization.GetString(key, value), Localization.GetString(key, _language));
=> string.Format(text, LocalizationHelper.GetString(key, value), LocalizationHelper.GetString(key, _language));
MessageBoxHelper.Unregister();
MessageBoxHelper.Yes = FormatText("{0}({1})", "Ok");
MessageBoxHelper.No = FormatText("{0}({1})", "ManualRestart");
@@ -2594,8 +2593,8 @@ namespace MaaWpfGui.ViewModels.UI
{
ConfigurationHelper.SetValue(ConfigurationKeys.Localization, PallasLangKey);
var result = _windowManager.ShowMessageBox(
Localization.GetString("DrunkAndStaggering"),
Localization.GetString("Burping"),
LocalizationHelper.GetString("DrunkAndStaggering"),
LocalizationHelper.GetString("Burping"),
MessageBoxButton.OK, MessageBoxImage.Asterisk);
if (result == MessageBoxResult.OK)
{
@@ -2658,7 +2657,7 @@ namespace MaaWpfGui.ViewModels.UI
RoguelikeSquadList = new ObservableCollection<CombinedData>
{
new CombinedData { Display = Localization.GetString("DefaultSquad"), Value = string.Empty },
new CombinedData { Display = LocalizationHelper.GetString("DefaultSquad"), Value = string.Empty },
};
switch (RoguelikeTheme)
@@ -2670,9 +2669,9 @@ namespace MaaWpfGui.ViewModels.UI
case "Mizuki":
foreach (var item in new ObservableCollection<CombinedData>
{
new CombinedData { Display = Localization.GetString("IS2NewSquad1"), Value = "心胜于物分队" },
new CombinedData { Display = Localization.GetString("IS2NewSquad2"), Value = "物尽其用分队" },
new CombinedData { Display = Localization.GetString("IS2NewSquad3"), Value = "以人为本分队" },
new CombinedData { Display = LocalizationHelper.GetString("IS2NewSquad1"), Value = "心胜于物分队" },
new CombinedData { Display = LocalizationHelper.GetString("IS2NewSquad2"), Value = "物尽其用分队" },
new CombinedData { Display = LocalizationHelper.GetString("IS2NewSquad3"), Value = "以人为本分队" },
})
{
RoguelikeSquadList.Add(item);
@@ -2684,16 +2683,16 @@ namespace MaaWpfGui.ViewModels.UI
// 通用分队
foreach (var item in new ObservableCollection<CombinedData>
{
new CombinedData { Display = Localization.GetString("LeaderSquad"), Value = "指挥分队" },
new CombinedData { Display = Localization.GetString("GatheringSquad"), Value = "集群分队" },
new CombinedData { Display = Localization.GetString("SupportSquad"), Value = "后勤分队" },
new CombinedData { Display = Localization.GetString("SpearheadSquad"), Value = "矛头分队" },
new CombinedData { Display = Localization.GetString("TacticalAssaultOperative"), Value = "突击战术分队" },
new CombinedData { Display = Localization.GetString("TacticalFortificationOperative"), Value = "堡垒战术分队" },
new CombinedData { Display = Localization.GetString("TacticalRangedOperative"), Value = "远程战术分队" },
new CombinedData { Display = Localization.GetString("TacticalDestructionOperative"), Value = "破坏战术分队" },
new CombinedData { Display = Localization.GetString("ResearchSquad"), Value = "研究分队" },
new CombinedData { Display = Localization.GetString("First-ClassSquad"), Value = "高规格分队" },
new CombinedData { Display = LocalizationHelper.GetString("LeaderSquad"), Value = "指挥分队" },
new CombinedData { Display = LocalizationHelper.GetString("GatheringSquad"), Value = "集群分队" },
new CombinedData { Display = LocalizationHelper.GetString("SupportSquad"), Value = "后勤分队" },
new CombinedData { Display = LocalizationHelper.GetString("SpearheadSquad"), Value = "矛头分队" },
new CombinedData { Display = LocalizationHelper.GetString("TacticalAssaultOperative"), Value = "突击战术分队" },
new CombinedData { Display = LocalizationHelper.GetString("TacticalFortificationOperative"), Value = "堡垒战术分队" },
new CombinedData { Display = LocalizationHelper.GetString("TacticalRangedOperative"), Value = "远程战术分队" },
new CombinedData { Display = LocalizationHelper.GetString("TacticalDestructionOperative"), Value = "破坏战术分队" },
new CombinedData { Display = LocalizationHelper.GetString("ResearchSquad"), Value = "研究分队" },
new CombinedData { Display = LocalizationHelper.GetString("First-ClassSquad"), Value = "高规格分队" },
})
{
RoguelikeSquadList.Add(item);

View File

@@ -35,7 +35,6 @@ using Newtonsoft.Json.Linq;
using Serilog;
using Stylet;
using StyletIoC;
using Localization = MaaWpfGui.Helper.Localization;
namespace MaaWpfGui.ViewModels.UI
{
@@ -137,7 +136,7 @@ namespace MaaWpfGui.ViewModels.UI
_stageManager = _container.Get<StageManager>();
_maaHotKeyManager = _container.Get<IMaaHotKeyManager>();
DisplayName = Localization.GetString("Farming");
DisplayName = LocalizationHelper.GetString("Farming");
LogItemViewModels = new ObservableCollection<LogItemViewModel>();
InitializeItems();
InitTimer();
@@ -245,20 +244,20 @@ namespace MaaWpfGui.ViewModels.UI
};
ActionAfterCompletedList = new List<GenericCombinedData<ActionType>>
{
new GenericCombinedData<ActionType> { Display = Localization.GetString("DoNothing"), Value = ActionType.DoNothing },
new GenericCombinedData<ActionType> { Display = Localization.GetString("ExitArknights"), Value = ActionType.StopGame },
new GenericCombinedData<ActionType> { Display = Localization.GetString("ExitEmulator"), Value = ActionType.ExitEmulator },
new GenericCombinedData<ActionType> { Display = Localization.GetString("ExitSelf"), Value = ActionType.ExitSelf },
new GenericCombinedData<ActionType> { Display = Localization.GetString("ExitEmulatorAndSelf"), Value = ActionType.ExitEmulatorAndSelf },
new GenericCombinedData<ActionType> { Display = LocalizationHelper.GetString("DoNothing"), Value = ActionType.DoNothing },
new GenericCombinedData<ActionType> { Display = LocalizationHelper.GetString("ExitArknights"), Value = ActionType.StopGame },
new GenericCombinedData<ActionType> { Display = LocalizationHelper.GetString("ExitEmulator"), Value = ActionType.ExitEmulator },
new GenericCombinedData<ActionType> { Display = LocalizationHelper.GetString("ExitSelf"), Value = ActionType.ExitSelf },
new GenericCombinedData<ActionType> { Display = LocalizationHelper.GetString("ExitEmulatorAndSelf"), Value = ActionType.ExitEmulatorAndSelf },
// new GenericCombData<ActionTypeAfterCompleted>{ Display="待机",Value=ActionTypeAfterCompleted.Suspend },
new GenericCombinedData<ActionType> { Display = Localization.GetString("ExitEmulatorAndSelfAndHibernate"), Value = ActionType.ExitEmulatorAndSelfAndHibernate },
new GenericCombinedData<ActionType> { Display = Localization.GetString("Hibernate"), Value = ActionType.Hibernate },
new GenericCombinedData<ActionType> { Display = Localization.GetString("Shutdown"), Value = ActionType.Shutdown },
new GenericCombinedData<ActionType> { Display = LocalizationHelper.GetString("ExitEmulatorAndSelfAndHibernate"), Value = ActionType.ExitEmulatorAndSelfAndHibernate },
new GenericCombinedData<ActionType> { Display = LocalizationHelper.GetString("Hibernate"), Value = ActionType.Hibernate },
new GenericCombinedData<ActionType> { Display = LocalizationHelper.GetString("Shutdown"), Value = ActionType.Shutdown },
// new GenericCombData<ActionType> { Display = Localization.GetString("ExitEmulatorAndSelfAndHibernate") + "*", Value = ActionType.ExitEmulatorAndSelfAndHibernateWithoutPersist },
new GenericCombinedData<ActionType> { Display = Localization.GetString("Hibernate") + "*", Value = ActionType.HibernateWithoutPersist },
new GenericCombinedData<ActionType> { Display = Localization.GetString("Shutdown") + "*", Value = ActionType.ShutdownWithoutPersist },
new GenericCombinedData<ActionType> { Display = LocalizationHelper.GetString("Hibernate") + "*", Value = ActionType.HibernateWithoutPersist },
new GenericCombinedData<ActionType> { Display = LocalizationHelper.GetString("Shutdown") + "*", Value = ActionType.ShutdownWithoutPersist },
};
var temp_order_list = new List<DragItemViewModel>(new DragItemViewModel[task_list.Length]);
var non_order_list = new List<DragItemViewModel>();
@@ -267,7 +266,7 @@ namespace MaaWpfGui.ViewModels.UI
var task = task_list[i];
bool parsed = int.TryParse(ConfigurationHelper.GetTaskOrder(task, "-1"), out var order);
var vm = new DragItemViewModel(Localization.GetString(task), task, "TaskQueue.");
var vm = new DragItemViewModel(LocalizationHelper.GetString(task), task, "TaskQueue.");
if (!parsed || order < 0 || order >= temp_order_list.Count)
{
@@ -295,7 +294,7 @@ namespace MaaWpfGui.ViewModels.UI
RemainingSanityStageList = new ObservableCollection<CombinedData>(_stageManager.GetStageList())
{
// It's Cur/Last option
[0] = new CombinedData { Display = Localization.GetString("NoUse"), Value = string.Empty },
[0] = new CombinedData { Display = LocalizationHelper.GetString("NoUse"), Value = string.Empty },
};
InitDrops();
@@ -365,7 +364,7 @@ namespace MaaWpfGui.ViewModels.UI
var rss = RemainingSanityStage ??= string.Empty;
RemainingSanityStageList = new ObservableCollection<CombinedData>(_stageManager.GetStageList())
{
[0] = new CombinedData { Display = Localization.GetString("NoUse"), Value = string.Empty },
[0] = new CombinedData { Display = LocalizationHelper.GetString("NoUse"), Value = string.Empty },
};
if (!CustomStageCode)
{
@@ -420,7 +419,7 @@ namespace MaaWpfGui.ViewModels.UI
// 这个函数被列为public可见意味着他注入对象前被调用
public void UpdateDatePrompt()
{
var builder = new StringBuilder(Localization.GetString("TodaysStageTip") + "\n");
var builder = new StringBuilder(LocalizationHelper.GetString("TodaysStageTip") + "\n");
// Closed activity stages
var stages = new[] { Stage1, Stage2, Stage3 };
@@ -433,7 +432,7 @@ namespace MaaWpfGui.ViewModels.UI
if (_stageManager.GetStageInfo(stage)?.IsActivityClosed() == true)
{
builder.Append(stage).Append(": ").AppendLine(Localization.GetString("ClosedStage"));
builder.Append(stage).Append(": ").AppendLine(LocalizationHelper.GetString("ClosedStage"));
break;
}
}
@@ -517,8 +516,8 @@ namespace MaaWpfGui.ViewModels.UI
set
{
SetAndNotify(ref _inverseMode, value);
InverseShowText = value ? Localization.GetString("Inverse") : Localization.GetString("Clear");
InverseMenuText = value ? Localization.GetString("Clear") : Localization.GetString("Inverse");
InverseShowText = value ? LocalizationHelper.GetString("Inverse") : LocalizationHelper.GetString("Clear");
InverseMenuText = value ? LocalizationHelper.GetString("Clear") : LocalizationHelper.GetString("Inverse");
ConfigurationHelper.SetValue(ConfigurationKeys.MainFunctionInverseMode, value.ToString());
}
}
@@ -562,7 +561,7 @@ namespace MaaWpfGui.ViewModels.UI
set => SetAndNotify(ref _showInverse, value);
}
private string _inverseShowText = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.MainFunctionInverseMode, bool.FalseString)) ? Localization.GetString("Inverse") : Localization.GetString("Clear");
private string _inverseShowText = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.MainFunctionInverseMode, bool.FalseString)) ? LocalizationHelper.GetString("Inverse") : LocalizationHelper.GetString("Clear");
/// <summary>
/// Gets or sets the text to be displayed for "Select inversely".
@@ -573,7 +572,7 @@ namespace MaaWpfGui.ViewModels.UI
set => SetAndNotify(ref _inverseShowText, value);
}
private string _inverseMenuText = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.MainFunctionInverseMode, bool.FalseString)) ? Localization.GetString("Clear") : Localization.GetString("Inverse");
private string _inverseMenuText = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.MainFunctionInverseMode, bool.FalseString)) ? LocalizationHelper.GetString("Clear") : LocalizationHelper.GetString("Inverse");
/// <summary>
/// Gets or sets the text of inversion menu.
@@ -702,7 +701,7 @@ namespace MaaWpfGui.ViewModels.UI
if (count == 0)
{
AddLog(Localization.GetString("UnselectedTask"));
AddLog(LocalizationHelper.GetString("UnselectedTask"));
Idle = true;
SetStopped();
return;
@@ -715,7 +714,7 @@ namespace MaaWpfGui.ViewModels.UI
return;
}
AddLog(Localization.GetString("ConnectingToEmulator"));
AddLog(LocalizationHelper.GetString("ConnectingToEmulator"));
string errMsg = string.Empty;
var task = Task.Run(() =>
@@ -734,7 +733,7 @@ namespace MaaWpfGui.ViewModels.UI
if (!caught)
{
AddLog(errMsg, UiLogColor.Error);
AddLog(Localization.GetString("ConnectFailed") + "\n" + Localization.GetString("TryToStartEmulator"));
AddLog(LocalizationHelper.GetString("ConnectFailed") + "\n" + LocalizationHelper.GetString("TryToStartEmulator"));
var subtask = Task.Run(() =>
{
_settingsViewModel.TryToStartEmulator(true);
@@ -772,15 +771,15 @@ namespace MaaWpfGui.ViewModels.UI
if (ret)
{
AddLog(Localization.GetString("Running"));
AddLog(LocalizationHelper.GetString("Running"));
if (!_settingsViewModel.AdbReplaced && !_settingsViewModel.IsAdbTouchMode())
{
AddLog(Localization.GetString("AdbReplacementTips"), UiLogColor.Info);
AddLog(LocalizationHelper.GetString("AdbReplacementTips"), UiLogColor.Info);
}
}
else
{
AddLog(Localization.GetString("UnknownErrorOccurs"));
AddLog(LocalizationHelper.GetString("UnknownErrorOccurs"));
}
}
@@ -790,7 +789,7 @@ namespace MaaWpfGui.ViewModels.UI
public async void Stop()
{
Stopping = true;
AddLog(Localization.GetString("Stopping"));
AddLog(LocalizationHelper.GetString("Stopping"));
var task = Task.Run(_asstProxy.AsstStop);
await task;
}
@@ -799,7 +798,7 @@ namespace MaaWpfGui.ViewModels.UI
{
if (!Idle || Stopping)
{
AddLog(Localization.GetString("Stopped"));
AddLog(LocalizationHelper.GetString("Stopped"));
}
Stopping = false;
@@ -937,7 +936,7 @@ namespace MaaWpfGui.ViewModels.UI
{
if (_settingsViewModel.CustomInfrastEnabled && !File.Exists(_settingsViewModel.CustomInfrastFile))
{
AddLog(Localization.GetString("CustomizeInfrastSelectionEmpty"), UiLogColor.Error);
AddLog(LocalizationHelper.GetString("CustomizeInfrastSelectionEmpty"), UiLogColor.Error);
return false;
}
@@ -1405,7 +1404,7 @@ namespace MaaWpfGui.ViewModels.UI
case ActionType.StopGame:
if (!_asstProxy.AsstStartCloseDown())
{
AddLog(Localization.GetString("CloseArknightsFailed"), UiLogColor.Error);
AddLog(LocalizationHelper.GetString("CloseArknightsFailed"), UiLogColor.Error);
}
break;
@@ -1420,7 +1419,7 @@ namespace MaaWpfGui.ViewModels.UI
case ActionType.ExitEmulator:
if (!KillEmulatorModeSwitcher())
{
AddLog(Localization.GetString("ExitEmulatorFailed"), UiLogColor.Error);
AddLog(LocalizationHelper.GetString("ExitEmulatorFailed"), UiLogColor.Error);
}
break;
@@ -1428,7 +1427,7 @@ namespace MaaWpfGui.ViewModels.UI
case ActionType.ExitEmulatorAndSelf:
if (!KillEmulatorModeSwitcher())
{
AddLog(Localization.GetString("ExitEmulatorFailed"), UiLogColor.Error);
AddLog(LocalizationHelper.GetString("ExitEmulatorFailed"), UiLogColor.Error);
}
// Shutdown 会调用 OnExit 但 Exit 不会
@@ -1442,7 +1441,7 @@ namespace MaaWpfGui.ViewModels.UI
Process.Start("shutdown.exe", "-s -t 60");
// 关机询问
var shutdownResult = _windowManager.ShowMessageBox(Localization.GetString("AboutToShutdown"), Localization.GetString("ShutdownPrompt"), MessageBoxButton.OK, MessageBoxImage.Question);
var shutdownResult = _windowManager.ShowMessageBox(LocalizationHelper.GetString("AboutToShutdown"), LocalizationHelper.GetString("ShutdownPrompt"), MessageBoxButton.OK, MessageBoxImage.Question);
if (shutdownResult == MessageBoxResult.OK)
{
Process.Start("shutdown.exe", "-a");
@@ -1459,7 +1458,7 @@ namespace MaaWpfGui.ViewModels.UI
case ActionType.Hibernate:
case ActionType.HibernateWithoutPersist:
// 休眠提示
AddLog(Localization.GetString("HibernatePrompt"), UiLogColor.Error);
AddLog(LocalizationHelper.GetString("HibernatePrompt"), UiLogColor.Error);
// 休眠不能加时间参数https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/1133
Process.Start("shutdown.exe", "-h");
@@ -1469,11 +1468,11 @@ namespace MaaWpfGui.ViewModels.UI
case ActionType.ExitEmulatorAndSelfAndHibernateWithoutPersist:
if (!KillEmulatorModeSwitcher())
{
AddLog(Localization.GetString("ExitEmulatorFailed"), UiLogColor.Error);
AddLog(LocalizationHelper.GetString("ExitEmulatorFailed"), UiLogColor.Error);
}
// 休眠提示
AddLog(Localization.GetString("HibernatePrompt"), UiLogColor.Error);
AddLog(LocalizationHelper.GetString("HibernatePrompt"), UiLogColor.Error);
// 休眠不能加时间参数https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/1133
Process.Start("shutdown.exe", "-h");
@@ -1908,7 +1907,7 @@ namespace MaaWpfGui.ViewModels.UI
if (_customInfrastInfoOutput && root.ContainsKey("title"))
{
AddLog(Localization.GetString("CustomInfrastTitle"), UiLogColor.Message);
AddLog(LocalizationHelper.GetString("CustomInfrastTitle"), UiLogColor.Message);
AddLog(root["title"].ToString(), UiLogColor.Info);
if (root.ContainsKey("description"))
{
@@ -1986,7 +1985,7 @@ namespace MaaWpfGui.ViewModels.UI
catch (Exception)
{
_customInfrastInfoOutput = true;
AddLog(Localization.GetString("CustomInfrastFileParseFailed"), UiLogColor.Error);
AddLog(LocalizationHelper.GetString("CustomInfrastFileParseFailed"), UiLogColor.Error);
return;
}
@@ -2024,7 +2023,7 @@ namespace MaaWpfGui.ViewModels.UI
return;
}
AddLog(Localization.GetString("CustomInfrastPlanIndexAutoSwitch"), UiLogColor.Message);
AddLog(LocalizationHelper.GetString("CustomInfrastPlanIndexAutoSwitch"), UiLogColor.Message);
var prePlanPostDesc = CustomInfrastPlanInfoList[CustomInfrastPlanIndex].DescriptionPost;
if (prePlanPostDesc != string.Empty)
{
@@ -2263,7 +2262,7 @@ namespace MaaWpfGui.ViewModels.UI
}
}
private string _dropsItemName = ConfigurationHelper.GetValue(ConfigurationKeys.DropsItemName, Localization.GetString("NotSelected"));
private string _dropsItemName = ConfigurationHelper.GetValue(ConfigurationKeys.DropsItemName, LocalizationHelper.GetString("NotSelected"));
/// <summary>
/// Gets or sets the item Name of drops.
@@ -2289,14 +2288,14 @@ namespace MaaWpfGui.ViewModels.UI
if (DropsItemName != item.Display || DropsItemId != item.Value)
{
DropsItemName = Localization.GetString("NotSelected");
DropsItemName = LocalizationHelper.GetString("NotSelected");
}
return;
}
}
DropsItemName = Localization.GetString("NotSelected");
DropsItemName = LocalizationHelper.GetString("NotSelected");
}
private string _dropsQuantity = ConfigurationHelper.GetValue(ConfigurationKeys.DropsQuantity, "5");

View File

@@ -31,7 +31,6 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Stylet;
using StyletIoC;
using Localization = MaaWpfGui.Helper.Localization;
namespace MaaWpfGui.ViewModels.UI
{
@@ -190,8 +189,8 @@ namespace MaaWpfGui.ViewModels.UI
Execute.OnUIThread(() =>
{
using var toast = new ToastNotification(Localization.GetString("NewVersionZipFileFoundTitle"));
toast.AppendContentText(Localization.GetString("NewVersionZipFileFoundDescDecompressing"))
using var toast = new ToastNotification(LocalizationHelper.GetString("NewVersionZipFileFoundTitle"));
toast.AppendContentText(LocalizationHelper.GetString("NewVersionZipFileFoundDescDecompressing"))
.AppendContentText(UpdateTag)
.ShowUpdateVersion(row: 2);
});
@@ -215,9 +214,9 @@ namespace MaaWpfGui.ViewModels.UI
File.Delete(UpdatePackageName);
Execute.OnUIThread(() =>
{
using var toast = new ToastNotification(Localization.GetString("NewVersionZipFileBrokenTitle"));
toast.AppendContentText(Localization.GetString("NewVersionZipFileBrokenDescFilename") + UpdatePackageName)
.AppendContentText(Localization.GetString("NewVersionZipFileBrokenDescDeleted"))
using var toast = new ToastNotification(LocalizationHelper.GetString("NewVersionZipFileBrokenTitle"));
toast.AppendContentText(LocalizationHelper.GetString("NewVersionZipFileBrokenDescFilename") + UpdatePackageName)
.AppendContentText(LocalizationHelper.GetString("NewVersionZipFileBrokenDescDeleted"))
.ShowUpdateVersion();
});
return false;
@@ -411,7 +410,7 @@ namespace MaaWpfGui.ViewModels.UI
bool goDownload = otaFound && _settingsViewModel.AutoDownloadUpdatePackage;
#pragma warning disable IDE0042
var openUrlToastButton = (
text: Localization.GetString("NewVersionFoundButtonGoWebpage"),
text: LocalizationHelper.GetString("NewVersionFoundButtonGoWebpage"),
action: new Action(() =>
{
if (!string.IsNullOrWhiteSpace(UpdateUrl))
@@ -423,25 +422,25 @@ namespace MaaWpfGui.ViewModels.UI
Execute.OnUIThread(() =>
{
using var toast = new ToastNotification(otaFound ?
Localization.GetString("NewVersionFoundTitle") :
Localization.GetString("NewVersionFoundButNoPackageTitle"));
LocalizationHelper.GetString("NewVersionFoundTitle") :
LocalizationHelper.GetString("NewVersionFoundButNoPackageTitle"));
if (goDownload)
{
OutputDownloadProgress(downloading: false, output: Localization.GetString("NewVersionDownloadPreparing"));
toast.AppendContentText(Localization.GetString("NewVersionFoundDescDownloading"));
OutputDownloadProgress(downloading: false, output: LocalizationHelper.GetString("NewVersionDownloadPreparing"));
toast.AppendContentText(LocalizationHelper.GetString("NewVersionFoundDescDownloading"));
}
toast.AppendContentText(Localization.GetString("NewVersionFoundDescId") + UpdateTag);
toast.AppendContentText(LocalizationHelper.GetString("NewVersionFoundDescId") + UpdateTag);
if (!otaFound)
{
toast.AppendContentText(Localization.GetString("NewVersionFoundButNoPackageDesc"));
toast.AppendContentText(LocalizationHelper.GetString("NewVersionFoundButNoPackageDesc"));
}
var toastDesc = UpdateInfo.Length > 100 ?
UpdateInfo.Substring(0, 100) + "..." :
UpdateInfo;
toast.AppendContentText(Localization.GetString("NewVersionFoundDescInfo") + toastDesc);
toast.AppendContentText(LocalizationHelper.GetString("NewVersionFoundDescInfo") + toastDesc);
toast.AddButtonLeft(openUrlToastButton.text, openUrlToastButton.action);
toast.ButtonSystemUrl = UpdateUrl;
toast.ShowUpdateVersion();
@@ -481,7 +480,7 @@ namespace MaaWpfGui.ViewModels.UI
if (DownloadGithubAssets(url, _assetsObject, Downloader.Native))
{
OutputDownloadProgress(downloading: false, output: Localization.GetString("NewVersionDownloadCompletedTitle"));
OutputDownloadProgress(downloading: false, output: LocalizationHelper.GetString("NewVersionDownloadCompletedTitle"));
downloaded = true;
break;
}
@@ -490,12 +489,12 @@ namespace MaaWpfGui.ViewModels.UI
if (!downloaded)
{
OutputDownloadProgress(downloading: false, output: Localization.GetString("NewVersionDownloadFailedTitle"));
OutputDownloadProgress(downloading: false, output: LocalizationHelper.GetString("NewVersionDownloadFailedTitle"));
Execute.OnUIThread(() =>
{
using var toast = new ToastNotification(Localization.GetString("NewVersionDownloadFailedTitle"));
using var toast = new ToastNotification(LocalizationHelper.GetString("NewVersionDownloadFailedTitle"));
toast.ButtonSystemUrl = UpdateUrl;
toast.AppendContentText(Localization.GetString("NewVersionDownloadFailedDesc"))
toast.AppendContentText(LocalizationHelper.GetString("NewVersionDownloadFailedDesc"))
.AddButtonLeft(openUrlToastButton.text, openUrlToastButton.action)
.Show();
});
@@ -512,12 +511,12 @@ namespace MaaWpfGui.ViewModels.UI
public void AskToRestart()
{
MessageBoxHelper.Unregister();
MessageBoxHelper.Yes = Localization.GetString("Ok");
MessageBoxHelper.No = Localization.GetString("ManualRestart");
MessageBoxHelper.Yes = LocalizationHelper.GetString("Ok");
MessageBoxHelper.No = LocalizationHelper.GetString("ManualRestart");
MessageBoxHelper.Register();
var result = MessageBox.Show(
Localization.GetString("NewVersionDownloadCompletedDesc"),
Localization.GetString("NewVersionDownloadCompletedTitle"),
LocalizationHelper.GetString("NewVersionDownloadCompletedDesc"),
LocalizationHelper.GetString("NewVersionDownloadCompletedTitle"),
MessageBoxButton.YesNo,
MessageBoxImage.Question);
MessageBoxHelper.Unregister();
@@ -884,7 +883,7 @@ namespace MaaWpfGui.ViewModels.UI
return;
}
var log = new LogItemViewModel(downloading ? Localization.GetString("NewVersionFoundDescDownloading") + "\n" + output : output, UiLogColor.Download);
var log = new LogItemViewModel(downloading ? LocalizationHelper.GetString("NewVersionFoundDescDownloading") + "\n" + output : output, UiLogColor.Download);
Application.Current.Dispatcher.Invoke(() =>
{

View File

@@ -17,7 +17,6 @@ using System.Windows;
using System.Windows.Documents;
using MaaWpfGui.Constants;
using MaaWpfGui.Helper;
using Localization = MaaWpfGui.Helper.Localization;
namespace MaaWpfGui.Views.UI
{
@@ -43,7 +42,7 @@ namespace MaaWpfGui.Views.UI
ShouldExit = shouldExit;
var isZhCn = ConfigurationHelper.GetValue(ConfigurationKeys.Localization, Localization.DefaultLanguage) == "zh-cn";
var isZhCn = ConfigurationHelper.GetValue(ConfigurationKeys.Localization, LocalizationHelper.DefaultLanguage) == "zh-cn";
ErrorQqGroupLink.Visibility = isZhCn ? Visibility.Visible : Visibility.Hidden;
}
@@ -51,15 +50,15 @@ namespace MaaWpfGui.Views.UI
{
if (details.Contains("AsstGetVersion()") || details.Contains("DllNotFoundException"))
{
return Localization.GetString("ErrorSolutionCrash");
return LocalizationHelper.GetString("ErrorSolutionCrash");
}
if (details.Contains("SettingsViewModel.<ReplaceADB>"))
{
return Localization.GetString("ErrorSolutionReplaceADB");
return LocalizationHelper.GetString("ErrorSolutionReplaceADB");
}
return Localization.GetString("UnknownErrorOccurs");
return LocalizationHelper.GetString("UnknownErrorOccurs");
}
protected override void OnClosed(EventArgs e)