Skip to content

Commit

Permalink
fix(baidu-bin): skip when flag is false
Browse files Browse the repository at this point in the history
  • Loading branch information
nopdan committed Mar 21, 2024
1 parent e6ef15f commit 3012c56
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/ImeWlConverterCore/IME/BaiduPinyinBackup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ public WordLibraryList Import(string path)
if (bytes[0] == 0x0A && bytes[1] == 0x00) break;
lineBytes.AddRange(bytes);
} while (true);
var line = Decode(lineBytes.ToArray());
var theLine = Encoding.Unicode.GetString(line);
var decoded = Decode(lineBytes.ToArray());
var line = Encoding.Unicode.GetString(decoded);
// 忽略英文单词
if (cnFlag && (theLine == "<enword>" || theLine == "<sysusrword>")) break;
if (theLine == "<cnword>") { cnFlag = true; continue; }
if (cnFlag && (line == "<enword>" || line == "<sysusrword>")) break;
if (line == "<cnword>") { cnFlag = true; continue; }
if (!cnFlag) continue;
// 每一行的格式
// 百度输入法(bai|du|shu|ru|fa) 2 24 1703756731 N N
var array = theLine.Split(" ");
var array = line.Split(" ");
if (array.Length < 2) continue;
var rank = Convert.ToInt32(array[1]);
// 用正则分离词组和拼音
Expand Down

0 comments on commit 3012c56

Please sign in to comment.