Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
studyzy committed Mar 12, 2014
1 parent de1040a commit 95ff5c0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion IME WL Converter/IME WL Converter/Entities/WordLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public string[] PinYin
}
set
{
CodeType=CodeType.Pinyin;
//CodeType=CodeType.Pinyin;
Codes=new List<string>[value.Length];
int i = 0;
foreach (string s in value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ private static Dictionary<char, ChineseCode> Dict
if (dictionary.Count == 0)
{
string allPinYin = Dictionaries.ChineseCode;
string[] pyList = allPinYin.Split(new[] {"\r\n"}, StringSplitOptions.RemoveEmptyEntries);
string[] pyList = allPinYin.Split(new[] {"\r","\n"}, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < pyList.Length; i++)
{
string[] hzpy = pyList[i].Split('\t');
Expand Down
4 changes: 4 additions & 0 deletions IME WL Converter/IME WL Converter/IME/QQPinyin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public string ExportLine(WordLibrary wl)

public string Export(WordLibraryList wlList)
{
if (wlList.Count == 0)
{
return "";
}
var sb = new StringBuilder();
for (int i = 0; i < wlList.Count - 1; i++)
{
Expand Down
7 changes: 4 additions & 3 deletions IME WL Converter/IME WL Converter/IME/ZiGuangPinyinUwl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ private WordLibrary Parse(Stream stream, out int lenByte)
wl.Count = (BitConverter.ToInt32(rankB, 0) - 1)/32;
//py
int pyLen = Math.Min(8, len); //拼音最大支持8个字的拼音
wl.PinYin = new string[pyLen];
var wlPinYin = new string[pyLen];
for (int i = 0; i < pyLen; i++)
{
int smB = stream.ReadByte();
Expand All @@ -261,18 +261,19 @@ private WordLibrary Parse(Stream stream, out int lenByte)
//wl.PinYin[i] = smIndex + "~" + ymIndex;
try
{
wl.PinYin[i] = Shengmu[smIndex] + Yunmu[ymIndex];
wlPinYin[i] = Shengmu[smIndex] + Yunmu[ymIndex];
}
catch
{
#if DEBUG
wl.PinYin[i] = smIndex + "~" + ymIndex;
wlPinYin[i] = smIndex + "~" + ymIndex;
Debug.WriteLine(stream.Position);
#else
return null;
#endif
}
}
wl.PinYin = wlPinYin;
//hz
var hzB = new byte[len*2];
stream.Read(hzB, 0, len*2);
Expand Down

0 comments on commit 95ff5c0

Please sign in to comment.