public static void SerializeToken(Stream stream, Pullenti.Ner.Token t) { short typ = (short)0; if (t is Pullenti.Ner.TextToken) { typ = 1; } else if (t is Pullenti.Ner.NumberToken) { typ = 2; } else if (t is Pullenti.Ner.ReferentToken) { typ = 3; } else if (t is Pullenti.Ner.MetaToken) { typ = 4; } SerializeShort(stream, typ); if (typ == 0) { return; } t.Serialize(stream); if (t is Pullenti.Ner.MetaToken) { SerializeTokens(stream, (t as Pullenti.Ner.MetaToken).BeginToken, t.EndChar); } }