From c9f7fc1d5768ee6f76bb3ebb9d676fcf75cfdce5 Mon Sep 17 00:00:00 2001 From: waynebian01 Date: Sat, 15 Aug 2026 14:00:15 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0=E5=AE=8F?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E6=96=87=E6=9C=AC=E5=A4=84=E7=90=86=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E7=AE=80=E5=8C=96=E4=BB=A3=E7=A0=81=E5=B9=B6?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E4=B8=AD=E6=96=87=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/ReservedUnit.cs | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/Modules/ReservedUnit.cs b/Modules/ReservedUnit.cs index a65d9fb8..60cc05cc 100644 --- a/Modules/ReservedUnit.cs +++ b/Modules/ReservedUnit.cs @@ -46,7 +46,7 @@ internal static class ReservedUnit } } -/// 宏条件在 keymap/模块内保存原始标识,在界面使用中文名称。 +/// 宏条件在 keymap、模块和界面中统一使用原始标识。 internal static class MacroConditionText { private const int LegacyChannelingUnit = 36; @@ -70,12 +70,21 @@ internal static class MacroConditionText public static string Normalize(string? text) { - return Transform(text, toDisplay: false); + var parts = (text ?? string.Empty) + .Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries) + .Select(part => part.ToLowerInvariant() switch + { + // 只兼容读取旧版中文值;新数据及界面统一保留 WoW 宏条件名称。 + "channeling" or "引导中" => Channeling, + "nochanneling" or "非引导" => NoChanneling, + _ => part + }); + return string.Join(", ", parts); } public static string ToDisplayText(string? text) { - return Transform(text, toDisplay: true); + return Normalize(text); } public static string ParseDisplayText(string? text) @@ -83,16 +92,4 @@ internal static class MacroConditionText return Normalize(text); } - private static string Transform(string? text, bool toDisplay) - { - var parts = (text ?? string.Empty) - .Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries) - .Select(part => part.ToLowerInvariant() switch - { - "channeling" or "引导中" => toDisplay ? "引导中" : Channeling, - "nochanneling" or "非引导" => toDisplay ? "非引导" : NoChanneling, - _ => part - }); - return string.Join(", ", parts); - } }