Example #1
0
        private static object ReadValueType(Type valueType, ExtendedBinaryReader br, bool noAlign = false)
        {
            if (!noAlign)
            {
                br.AlignStream();
            }

            if (valueType == typeof(string))
            {
                return(br.ReadAlignedString());
            }
            else if (valueType == typeof(Int32))
            {
                return(br.ReadInt32());
            }
            else if (valueType == typeof(UInt32))
            {
                return(br.ReadUInt32());
            }
            else if (valueType == typeof(Int64))
            {
                return(br.ReadInt64());
            }
            else if (valueType == typeof(UInt64))
            {
                return(br.ReadUInt64());
            }
            else if (valueType == typeof(Int16))
            {
                return(br.ReadInt16());
            }
            else if (valueType == typeof(UInt16))
            {
                return(br.ReadUInt16());
            }
            else if (valueType == typeof(Byte))
            {
                return(br.ReadByte());
            }
            else if (valueType == typeof(SByte))
            {
                return(br.ReadSByte());
            }
            else if (valueType == typeof(Boolean))
            {
                return(br.ReadBoolean());
            }
            else if (valueType == typeof(Double))
            {
                return(br.ReadDouble());
            }
            else if (valueType == typeof(Single))
            {
                return(br.ReadSingle());
            }
            else
            {
                throw new ArgumentException($"{valueType} is not a value type");
            }
        }
Example #2
0
            public static Entry ReadEntry(ExtendedBinaryReader reader)
            {
                double score     = reader.ReadDouble();
                byte   enumIndex = reader.ReadByte();

                return(new Entry(score, enumIndex));
            }
Example #3
0
 public override void Read(ExtendedBinaryReader reader, Action <double> synchronizationCallback)
 {
     synchronizationCallback(reader.ReadDouble());
 }
 public override void Deserialize(ExtendedBinaryReader reader, Action <double> valueFixup)
 {
     valueFixup(reader.ReadDouble());
 }
Example #5
0
 public override object Read(ExtendedBinaryReader reader) => reader.ReadDouble();