File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
src/ImeWlConverterCore/IME Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,6 @@ public WordLibraryList Import(string path)
4040 #endregion
4141
4242 private Dictionary < int , string > pyDic = new Dictionary < int , string > ( ) ;
43- private static char [ ] a2zchar => "abcdefghijklmnopqrstuvwxyz" . ToCharArray ( ) ;
4443
4544 #region IWordLibraryImport Members
4645
@@ -171,7 +170,7 @@ private IList<WordLibrary> ReadAPinyinWord(FileStream fs)
171170 if ( key < pyDic . Count )
172171 wordPY . Add ( pyDic [ key ] ) ;
173172 else
174- wordPY . Add ( a2zchar [ key - pyDic . Count ] . ToString ( ) ) ;
173+ wordPY . Add ( ( ( char ) ( key - pyDic . Count + 97 ) ) . ToString ( ) ) ;
175174 //return null; // 用于调试,忽略编码异常的记录,不中止运行
176175 }
177176 //wordPY = wordPY.Remove(wordPY.Length - 1); //移除最后一个单引号
Original file line number Diff line number Diff line change @@ -179,7 +179,10 @@ private IList<WordLibrary> ReadAPinyinWord(FileStream fs)
179179 for ( int i = 0 ; i < count / 2 ; i ++ )
180180 {
181181 int key = str [ i * 2 ] + str [ i * 2 + 1 ] * 256 ;
182- wordPY . Add ( pyDic [ key ] ) ;
182+ if ( key < pyDic . Count )
183+ wordPY . Add ( pyDic [ key ] ) ;
184+ else
185+ wordPY . Add ( ( ( char ) ( key - pyDic . Count + 97 ) ) . ToString ( ) ) ;
183186 }
184187 //wordPY = wordPY.Remove(wordPY.Length - 1); //移除最后一个单引号
185188 //接下来读词语
You can’t perform that action at this time.
0 commit comments