public override T Read(Reader reader, int tag) { var stream = reader.Stream; switch (tag) { case TagBytes: return(Converter <T> .Convert(ReferenceReader.ReadBytes(reader))); case TagEmpty: return(Converter <T> .Convert(empty)); case TagList: return(Converter <T> .Convert(ReferenceReader.ReadArray <byte>(reader))); case TagUTF8Char: return(Converter <T> .Convert(ValueReader.ReadUTF8Char(stream))); case TagString: return(Converter <T> .Convert(ReferenceReader.ReadChars(reader))); default: return(base.Read(reader, tag)); } }
public override char[] Read(Reader reader, int tag) { var stream = reader.Stream; switch (tag) { case TagString: return(ReferenceReader.ReadChars(reader)); case TagUTF8Char: return(new char[] { ValueReader.ReadChar(stream) }); case TagList: return(ReferenceReader.ReadArray <char>(reader)); case TagEmpty: return(empty); case TagTrue: return(bool.TrueString.ToCharArray()); case TagFalse: return(bool.FalseString.ToCharArray()); case TagNaN: return(double.NaN.ToString().ToCharArray()); case TagInfinity: return(ValueReader.ReadInfinity(stream).ToString().ToCharArray()); case TagInteger: case TagLong: case TagDouble: return(Converter <char[]> .Convert(ValueReader.ReadUntil(stream, TagSemicolon))); case TagDate: return(Converter <char[]> .Convert(ReferenceReader.ReadDateTime(reader))); case TagTime: return(Converter <char[]> .Convert(ReferenceReader.ReadTime(reader))); case TagGuid: return(Converter <char[]> .Convert(ReferenceReader.ReadGuid(reader))); case TagBytes: return(Converter <char[]> .Convert(ReferenceReader.ReadBytes(reader))); default: if (tag >= '0' && tag <= '9') { return(new char[] { (char)tag }); } return(base.Read(reader, tag)); } }