2using System.Collections.Generic;
14 private MemoryStream ms;
22 this.ms =
new MemoryStream(Data);
40 return this.ms.ReadByte() != 0;
49 return (
byte)this.ms.ReadByte();
64 b = (byte)this.ms.ReadByte();
65 Value |= ((ulong)(b & 0x7f)) << Offset;
68 while ((b & 0x80) != 0);
85 if (Len >
int.MaxValue)
86 throw new Exception(
"Invalid binary serialization.");
89 byte[] Bin =
new byte[c];
90 this.ms.ReadAll(Bin, 0, c);
113 if (Len >
int.MaxValue)
114 throw new Exception(
"Invalid string serialization.");
117 byte[] Bin =
new byte[c];
118 this.ms.ReadAll(Bin, 0, c);
119 return Encoding.UTF8.GetString(Bin);
129 return (sbyte)this.ms.ReadByte();
138 short Value = (short)this.ms.ReadByte();
139 Value |= (short)(this.ms.ReadByte() << 8);
174 return (
byte)this.ms.ReadByte();
183 ushort Value = (ushort)this.ms.ReadByte();
184 Value |= (ushort)(this.ms.ReadByte() << 8);
219 byte[] Bin =
new byte[4];
220 this.ms.ReadAll(Bin, 0, 4);
221 return BitConverter.ToSingle(Bin, 0);
230 byte[] Bin =
new byte[8];
231 this.ms.ReadAll(Bin, 0, 8);
232 return BitConverter.ToDouble(Bin, 0);
241 int[] A =
new int[4];
244 for (i = 0; i < 4; i++)
247 return new decimal(A);
266 DateTimeKind Kind = (DateTimeKind)this.ms.ReadByte();
268 return new DateTime(Ticks, Kind);
278 return new TimeSpan(Ticks);
290 return new DateTimeOffset(TP, Offset);
299 byte[] Bin =
new byte[16];
300 this.ms.ReadAll(Bin, 0, 16);
301 return new Guid(Bin);
byte ReadUInt8()
Reads a 8-bit unsigned integer from the input.
short ReadInt16()
Reads a 16-bit signed integer from the input.
long ReadInt64()
Reads a 64-bit signed integer from the input.
byte[] ReadBinary()
Reads binary data from the input.
void Dispose()
IDisposable.Dispose
decimal ReadDecimal()
Reads a decimal number from the input.
ulong ReadUInt64()
Reads a 64-bit unsigned integer from the input.
ushort ReadUInt16()
Reads a 16-bit unsigned integer from the input.
Deserializer(byte[] Data)
Cluster serializer
ulong ReadVarUInt64()
Reads a variable-length unsigned integer from the input.
int ReadInt32()
Reads a 32-bit signed integer from the input.
char ReadCharacter()
Reads a character from the input.
double ReadDouble()
Reads a double-precision floating point number from the input.
byte ReadByte()
Reads a byte from the input.
Guid ReadGuid()
Reads a Guid from the input.
DateTime ReadDateTime()
Reads a DateTime from the input.
uint ReadUInt32()
Reads a 32-bit unsigned integer from the input.
TimeSpan ReadTimeSpan()
Reads a TimeSpan from the input.
sbyte ReadInt8()
Reads a 8-bit signed integer from the input.
string ReadString()
Reads a string from the input.
float ReadSingle()
Reads a single-precision floating point number from the input.
DateTimeOffset ReadDateTimeOffset()
Reads a DateTimeOffset from the input.
bool ReadBoolean()
Reads a boolean value from the input.