/// <summary> /// 检索具有指定笔画数的所有字符串。 /// </summary> /// <param name="strokeNumber">指出需要被识别的笔画数。</param> /// <returns>返回具有指定笔画数的字符列表。 如果笔画数是无效值返回空。</returns> public static char[] GetChars(short strokeNumber) { if (!ChineseChar.IsValidStrokeNumber(strokeNumber)) { return(null); } StrokeUnit strokeUnit = ChineseChar.strokeDictionary.GetStrokeUnit((int)strokeNumber); return(strokeUnit.CharList); }
/// <summary> /// 识别给出的笔画数是否是一个有效的笔画数。 /// </summary> /// <param name="strokeNumber">指出需要识别的笔画数。</param> /// <returns>如果指定的笔画数是一个有效的笔画数则返回ture,否则返回false。</returns> public static bool IsValidStrokeNumber(short strokeNumber) { if (strokeNumber < 0 || strokeNumber > 48) { return(false); } StrokeUnit strokeUnit = ChineseChar.strokeDictionary.GetStrokeUnit((int)strokeNumber); return(strokeUnit != null); }
internal static StrokeUnit Deserialize(BinaryReader binaryReader) { StrokeUnit strokeUnit = new StrokeUnit(); strokeUnit.StrokeNumber = binaryReader.ReadByte(); strokeUnit.CharCount = binaryReader.ReadInt16(); strokeUnit.CharList = new char[(int)strokeUnit.CharCount]; for (int i = 0; i < (int)strokeUnit.CharCount; i++) { strokeUnit.CharList[i] = binaryReader.ReadChar(); } return(strokeUnit); }
internal static StrokeUnit Deserialize(BinaryReader binaryReader) { var strokeUnit = new StrokeUnit { StrokeNumber = binaryReader.ReadByte(), CharCount = binaryReader.ReadInt16() }; strokeUnit.CharList = new char[(int)strokeUnit.CharCount]; for (int index = 0; index < (int)strokeUnit.CharCount; ++index) { strokeUnit.CharList[index] = binaryReader.ReadChar(); } return(strokeUnit); }
internal static StrokeDictionary Deserialize(BinaryReader binaryReader) { StrokeDictionary dictionary = new StrokeDictionary(); binaryReader.ReadInt32(); dictionary.Length = binaryReader.ReadInt32(); dictionary.Count = binaryReader.ReadInt32(); dictionary.Offset = binaryReader.ReadInt16(); binaryReader.ReadBytes(0x18); dictionary.StrokeUnitTable = new List <StrokeUnit>(); for (int i = 0; i < dictionary.Count; i++) { dictionary.StrokeUnitTable.Add(StrokeUnit.Deserialize(binaryReader)); } binaryReader.ReadInt16(); return(dictionary); }
internal static StrokeUnit Deserialize(BinaryReader binaryReader) { StrokeUnit unit; unit = new StrokeUnit { StrokeNumber = binaryReader.ReadByte(), CharCount = binaryReader.ReadInt16(), CharList = null }; unit.CharList = new char[unit.CharCount]; for (int i = 0; i < unit.CharCount; i++) { unit.CharList[i] = binaryReader.ReadChar(); } return(unit); }
internal static StrokeDictionary Deserialize(BinaryReader binaryReader) { StrokeDictionary strokeDictionary = new StrokeDictionary(); binaryReader.ReadInt32(); strokeDictionary.Length = binaryReader.ReadInt32(); strokeDictionary.Count = binaryReader.ReadInt32(); strokeDictionary.Offset = binaryReader.ReadInt16(); binaryReader.ReadBytes(24); strokeDictionary.StrokeUnitTable = new List <StrokeUnit>(); for (int index = 0; index < strokeDictionary.Count; ++index) { strokeDictionary.StrokeUnitTable.Add(StrokeUnit.Deserialize(binaryReader)); } int num = (int)binaryReader.ReadInt16(); return(strokeDictionary); }
internal bool Match(StrokeUnit strokeUnit) { return(strokeUnit.StrokeNumber == ExpectedStrokeNum); }
internal bool Match(StrokeUnit strokeUnit) { return((int)strokeUnit.StrokeNumber == this.ExpectedStrokeNum); }