public bool Read(BinaryDataReader reader)
 {
     return(reader.ReadBool());
 }
Exemple #2
0
        private static JsonValue ReadValue(ref BinaryDataReader reader)
        {
            var t = reader.ReadNext();

            switch (t)
            {
            case ExportedDataTypes.@int:
                return(reader.ReadInt32());

            case ExportedDataTypes.asciiString:
                return(reader.ReadAsciiString());

            case ExportedDataTypes.@string:
                return(reader.ReadString());

            case ExportedDataTypes.utf8String:
                return(reader.ReadUtf8String());

            case ExportedDataTypes.@bool:
                return(reader.ReadBool());

            case ExportedDataTypes.@byte:
                return(reader.ReadByte());

            case ExportedDataTypes.@short:
                return(reader.ReadInt16());

            case ExportedDataTypes.@ushort:
                return(reader.ReadUInt16());

            case ExportedDataTypes.@uint:
                return(reader.ReadUInt32());

            case ExportedDataTypes.@long:
                return(reader.ReadInt64());

            case ExportedDataTypes.@ulong:
                return(reader.ReadUInt64());

            case ExportedDataTypes.@float:
                return(reader.ReadSingle());

            case ExportedDataTypes.@double:
                return(reader.ReadDouble());

            case ExportedDataTypes.@decimal:
                return(reader.ReadDecimal());

            case ExportedDataTypes.dateTime:
                return(reader.ReadDate());

            case ExportedDataTypes.@guid:
                return(reader.ReadGuid());

            case ExportedDataTypes.@null:
                return(null);

            case ExportedDataTypes.@object:
                JsonObject j = new JsonObject();
                ReadRaw(j, ref reader);
                return(j);

            case ExportedDataTypes.@array:
                JsonArray a = new JsonArray();
                ReadArrayRaw(a, ref reader);
                return(a);

            case ExportedDataTypes.byteArray:
            default:
                throw new FormatException($"Not supported ExportedDataType {t}");
            }
        }