Beispiel #1
0
 /// <summary>
 /// Serialize into binary stream.
 /// </summary>
 public void Serialize(BinWriter bw)
 {
     bw.WriteChar(Radical);
     bw.WriteChar(Phon);
     bw.WriteChar(Seman);
     bw.WriteString(Decomp);
     if (Strokes.Count > short.MaxValue)
     {
         throw new Exception("Strokes too long for serialization.");
     }
     bw.WriteShort((short)Strokes.Count);
     foreach (var os in Strokes)
     {
         os.Serialize(bw);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Serialize to binary.
 /// </summary>
 public void Serialize(BinWriter bw)
 {
     if (CanBeSimp)
     {
         bw.WriteByte(1);
     }
     else
     {
         bw.WriteByte(0);
     }
     bw.WriteByte((byte)TradVariants.Length);
     foreach (char c in TradVariants)
     {
         bw.WriteChar(c);
     }
     bw.WriteByte((byte)Pinyin.Length);
     foreach (PinyinSyllable syll in Pinyin)
     {
         syll.Serialize(bw);
     }
 }