diff --git a/Tekkon.Tests/Tekkon.Tests.csproj b/Tekkon.Tests/Tekkon.Tests.csproj index 05cdb91..7dece1a 100644 --- a/Tekkon.Tests/Tekkon.Tests.csproj +++ b/Tekkon.Tests/Tekkon.Tests.csproj @@ -4,7 +4,7 @@ net6.0 enable false - 1.4.0 + 1.4.1 diff --git a/Tekkon.sln b/Tekkon.sln index 08a84e6..77b90d1 100644 --- a/Tekkon.sln +++ b/Tekkon.sln @@ -47,6 +47,6 @@ Global $0.DotNetNamingPolicy = $4 $4.DirectoryNamespaceAssociation = PrefixedHierarchical $0.StandardHeader = $5 - version = 1.4.0 + version = 1.4.1 EndGlobalSection EndGlobal diff --git a/Tekkon/Composer.cs b/Tekkon/Composer.cs index 5d5154d..4b1f339 100644 --- a/Tekkon/Composer.cs +++ b/Tekkon/Composer.cs @@ -237,6 +237,54 @@ public void UpdateRomajiBuffer() { Semivowel.Value + Vowel.Value); } + /// + /// 自我變換單個注音資料值。 + /// + /// 要取代的內容。 + /// 要取代成的內容。 + private void FixValue(string strOf, string strWith) { + Phonabet theOld = new(strOf); + if (!string.IsNullOrEmpty(strOf)) { + switch (theOld.Type) { + case PhoneType.Consonant when Consonant.Value == theOld.Value: + Consonant.Clear(); + break; + case PhoneType.Semivowel when Semivowel.Value == theOld.Value: + Semivowel.Clear(); + break; + case PhoneType.Vowel when Vowel.Value == theOld.Value: + Vowel.Clear(); + break; + case PhoneType.Intonation when Intonation.Value == theOld.Value: + Intonation.Clear(); + break; + case PhoneType.Null: + return; + default: + return; + } + } + Phonabet theNew = new(strWith); + switch (theNew.Type) { + case PhoneType.Consonant: + Consonant = theNew; + break; + case PhoneType.Semivowel: + Semivowel = theNew; + break; + case PhoneType.Vowel: + Vowel = theNew; + break; + case PhoneType.Intonation: + Intonation = theNew; + break; + case PhoneType.Null: + return; + default: + return; + } + } + /// /// 接受傳入的按鍵訊號時的處理,處理對象為 String。
/// 另有同名函式可處理 UniChar 訊號。
@@ -616,7 +664,7 @@ private string HandleETen26(string key = "") { Vowel = new("ㄡ"); break; case true: - Vowel = new("ㄆ"); + Consonant = new("ㄆ"); break; default: Vowel = new("ㄡ"); @@ -630,12 +678,12 @@ private string HandleETen26(string key = "") { if ("dfjk ".Contains(key) && !Consonant.IsEmpty && Semivowel.IsEmpty && Vowel.IsEmpty) { - Consonant.SelfReplace("ㄆ", "ㄡ"); - Consonant.SelfReplace("ㄇ", "ㄢ"); - Consonant.SelfReplace("ㄊ", "ㄤ"); - Consonant.SelfReplace("ㄋ", "ㄣ"); - Consonant.SelfReplace("ㄌ", "ㄥ"); - Consonant.SelfReplace("ㄏ", "ㄦ"); + FixValue("ㄆ", "ㄡ"); + FixValue("ㄇ", "ㄢ"); + FixValue("ㄊ", "ㄤ"); + FixValue("ㄋ", "ㄣ"); + FixValue("ㄌ", "ㄥ"); + FixValue("ㄏ", "ㄦ"); } // 後置修正 @@ -773,26 +821,23 @@ private string HandleHsu(string key = "") { if ("dfjs ".Contains(key)) { if (!Consonant.IsEmpty && Semivowel.IsEmpty && Vowel.IsEmpty) { - Consonant.SelfReplace("ㄍ", "ㄜ"); - Consonant.SelfReplace("ㄋ", "ㄣ"); - Consonant.SelfReplace("ㄌ", "ㄦ"); - Consonant.SelfReplace("ㄎ", "ㄤ"); - Consonant.SelfReplace("ㄇ", "ㄢ"); - } - if (!Consonant.IsEmpty && Vowel.IsEmpty) { - Consonant.SelfReplace("ㄧ", "ㄝ"); + FixValue("ㄍ", "ㄜ"); + FixValue("ㄋ", "ㄣ"); + FixValue("ㄌ", "ㄦ"); + FixValue("ㄎ", "ㄤ"); + FixValue("ㄇ", "ㄢ"); } if (!Vowel.IsEmpty && "ㄢㄣㄤㄥ".Contains(Vowel.Value) && Semivowel.IsEmpty) { - Consonant.SelfReplace("ㄐ", "ㄓ"); - Consonant.SelfReplace("ㄑ", "ㄔ"); - Consonant.SelfReplace("ㄒ", "ㄕ"); + FixValue("ㄐ", "ㄓ"); + FixValue("ㄑ", "ㄔ"); + FixValue("ㄒ", "ㄕ"); } if (!Consonant.IsEmpty && "ㄐㄑㄒ".Contains(Consonant.Value) && Semivowel.IsEmpty) { - Consonant.SelfReplace("ㄐ", "ㄓ"); - Consonant.SelfReplace("ㄑ", "ㄔ"); - Consonant.SelfReplace("ㄒ", "ㄕ"); + FixValue("ㄐ", "ㄓ"); + FixValue("ㄑ", "ㄔ"); + FixValue("ㄒ", "ㄕ"); } if (Consonant.Value == "ㄏ" && Semivowel.IsEmpty && Vowel.IsEmpty) { Consonant.Clear(); @@ -847,13 +892,13 @@ private string HandleStarlight(string key = "") { if ("67890 ".Contains(key)) { if (!Consonant.IsEmpty && Semivowel.IsEmpty && Vowel.IsEmpty) { - Consonant.SelfReplace("ㄈ", "ㄠ"); - Consonant.SelfReplace("ㄍ", "ㄥ"); - Consonant.SelfReplace("ㄎ", "ㄤ"); - Consonant.SelfReplace("ㄌ", "ㄦ"); - Consonant.SelfReplace("ㄇ", "ㄢ"); - Consonant.SelfReplace("ㄋ", "ㄣ"); - Consonant.SelfReplace("ㄊ", "ㄟ"); + FixValue("ㄈ", "ㄠ"); + FixValue("ㄍ", "ㄥ"); + FixValue("ㄎ", "ㄤ"); + FixValue("ㄌ", "ㄦ"); + FixValue("ㄇ", "ㄢ"); + FixValue("ㄋ", "ㄣ"); + FixValue("ㄊ", "ㄟ"); } } @@ -1037,9 +1082,9 @@ private void CommonFixWhenHandlingDynamicArrangeInputs( break; case PhoneType.Vowel: if (Semivowel.IsEmpty && !Consonant.IsEmpty) { - Consonant.SelfReplace("ㄐ", "ㄓ"); - Consonant.SelfReplace("ㄑ", "ㄔ"); - Consonant.SelfReplace("ㄒ", "ㄕ"); + FixValue("ㄐ", "ㄓ"); + FixValue("ㄑ", "ㄔ"); + FixValue("ㄒ", "ㄕ"); } break; case PhoneType.Null: diff --git a/Tekkon/Tekkon.csproj b/Tekkon/Tekkon.csproj index f6f8a77..46cf9ed 100644 --- a/Tekkon/Tekkon.csproj +++ b/Tekkon/Tekkon.csproj @@ -3,16 +3,16 @@ net6.0 65001 - 1.4.0 + 1.4.1 vChewing.Tekkon Shiki Suen Atelier Inmu (c) 2022 and onwards The vChewing Project (MIT-NTL License). https://github.com/ShikiSuen/TekkonNT zh-TW - 1.4.0 - 1.4.0 - 1.4.0 + 1.4.1 + 1.4.1 + 1.4.1 Tekkon True README.md