/// <summary> /// 输出字符串 /// </summary> /// <param name="charStream"></param> /// <param name="deSerializer"></param> private void toString(CharStream charStream, ref JsonDeSerializer deSerializer) { switch (Type) { case NodeType.String: case NodeType.NumberString: case NodeType.ErrorQuoteString: charStream.Write(ref SubString); return; case NodeType.QuoteString: if (deSerializer == null) { deSerializer = JsonDeSerializer.YieldPool.Default.Pop() ?? new JsonDeSerializer(); } if (!deSerializer.DeSerializeQuoteString(ref SubString, charStream, (int)(Int64 >> 32), (char)Int64)) { Type = NodeType.ErrorQuoteString; } return; case NodeType.NaN: charStream.WriteJsonNaN(); return; case NodeType.PositiveInfinity: charStream.WritePositiveInfinity(); return; case NodeType.NegativeInfinity: charStream.WriteNegativeInfinity(); return; case NodeType.DateTimeTick: new DateTime(Int64, DateTimeKind.Local).ToString(charStream); return; case NodeType.Bool: charStream.WriteJsonBool((int)Int64 != 0); return; case NodeType.Array: int count = (int)Int64; if (count == 0) { charStream.WriteJsonArray(); } int isNext = 0; charStream.Write('['); foreach (Node node in ListArray) { if (isNext == 0) { isNext = 1; } else { charStream.Write(','); } node.toString(charStream, ref deSerializer); if (--count == 0) { charStream.Write(']'); return; } } return; case NodeType.Dictionary: charStream.WriteJsonObjectString(); return; } }
private void checkQuoteString() { Type = JsonDeSerializer.DeSerializeQuoteString(ref SubString, (int)(Int64 >> 32), (char)Int64, (int)Int64 >> 16) ? NodeType.String : NodeType.ErrorQuoteString; }