13 private MemoryStream ms;
21 this.ms =
new MemoryStream(Data);
39 return this.ms.ReadByte() != 0;
48 return (
byte)this.ms.ReadByte();
63 b = (byte)this.ms.ReadByte();
64 Value |= ((ulong)(b & 0x7f)) << Offset;
67 while ((b & 0x80) != 0);
84 if (Len >
int.MaxValue)
85 throw new Exception(
"Invalid binary serialization.");
88 byte[] Bin =
new byte[c];
89 this.ms.ReadAll(Bin, 0, c);
112 if (Len >
int.MaxValue)
113 throw new Exception(
"Invalid string serialization.");
116 byte[] Bin =
new byte[c];
117 this.ms.ReadAll(Bin, 0, c);
118 return Encoding.UTF8.GetString(Bin);
128 return (sbyte)this.ms.ReadByte();
137 short Value = (short)this.ms.ReadByte();
138 Value |= (short)(this.ms.ReadByte() << 8);
173 return (
byte)this.ms.ReadByte();
182 ushort Value = (ushort)this.ms.ReadByte();
183 Value |= (ushort)(this.ms.ReadByte() << 8);
218 byte[] Bin =
new byte[4];
219 this.ms.ReadAll(Bin, 0, 4);
220 return BitConverter.ToSingle(Bin, 0);
229 byte[] Bin =
new byte[8];
230 this.ms.ReadAll(Bin, 0, 8);
231 return BitConverter.ToDouble(Bin, 0);
240 int[] A =
new int[4];
243 for (i = 0; i < 4; i++)
246 return new decimal(A);
265 DateTimeKind Kind = (DateTimeKind)this.ms.ReadByte();
267 return new DateTime(Ticks, Kind);
277 return new TimeSpan(Ticks);
289 return new DateTimeOffset(TP, Offset);
298 byte[] Bin =
new byte[16];
299 this.ms.ReadAll(Bin, 0, 16);
300 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.