2using System.Collections.Generic;
13 private MemoryStream ms;
20 this.ms =
new MemoryStream();
38 return this.ms.ToArray();
47 this.ms.WriteByte(Value ? (
byte)1 : (
byte)0);
56 this.ms.WriteByte(Value);
69 b = (byte)(Value & 0x7f);
90 this.ms.Write(Value, 0, Value.Length);
100 this.ms.Write(Binary, 0, Binary.Length);
109 public void WriteRaw(
byte[] Binary,
int Offset,
int Count)
111 this.ms.Write(Binary, Offset, Count);
121 this.ms.WriteByte(0);
122 else if (
string.IsNullOrEmpty(Value))
123 this.ms.WriteByte(1);
126 byte[] Bin = Encoding.UTF8.GetBytes(Value);
129 this.ms.Write(Bin, 0, Bin.Length);
139 this.ms.WriteByte((
byte)Value);
148 this.ms.WriteByte((
byte)Value);
150 this.ms.WriteByte((
byte)Value);
159 byte[] Bin =
new byte[4];
162 for (i = 0; i < 4; i++)
164 Bin[i] = (byte)Value;
168 this.ms.Write(Bin, 0, 4);
177 byte[] Bin =
new byte[8];
180 for (i = 0; i < 8; i++)
182 Bin[i] = (byte)Value;
186 this.ms.Write(Bin, 0, 8);
195 this.ms.WriteByte(Value);
204 this.ms.WriteByte((
byte)Value);
206 this.ms.WriteByte((
byte)Value);
215 byte[] Bin =
new byte[4];
218 for (i = 0; i < 4; i++)
220 Bin[i] = (byte)Value;
224 this.ms.Write(Bin, 0, 4);
233 byte[] Bin =
new byte[8];
236 for (i = 0; i < 8; i++)
238 Bin[i] = (byte)Value;
242 this.ms.Write(Bin, 0, 8);
251 byte[] Bin = BitConverter.GetBytes(Value);
252 this.ms.Write(Bin, 0, Bin.Length);
261 byte[] Bin = BitConverter.GetBytes(Value);
262 this.ms.Write(Bin, 0, Bin.Length);
271 int[] A = decimal.GetBits(Value);
274 for (i = 0; i < 4; i++)
294 this.ms.WriteByte((
byte)Value.Kind);
322 byte[] Bin = Value.ToByteArray();
323 this.ms.Write(Bin, 0, Bin.Length);
void WriteUInt32(uint Value)
Writes a 32-bit unsigned integer to the output.
void WriteUInt64(ulong Value)
Writes a 64-bit unsigned integer to the output.
void WriteRaw(byte[] Binary)
Writes raw binary data to the output.
void WriteInt8(sbyte Value)
Writes a 8-bit signed integer to the output.
void WriteBoolean(bool Value)
Writes a boolean value to the output.
byte[] ToArray()
Returns the binary output.
void WriteInt32(int Value)
Writes a 32-bit signed integer to the output.
void WriteDateTimeOffset(DateTimeOffset Value)
Writes a DateTimeOffset to the output.
void WriteDateTime(DateTime Value)
Writes a DateTime to the output.
void WriteCharacter(char Value)
Writes a character to the output.
void Dispose()
IDisposable.Dispose
void WriteTimeSpan(TimeSpan Value)
Writes a TimeSpan to the output.
void WriteDecimal(decimal Value)
Writes a decimal number to the output.
void WriteVarUInt64(ulong Value)
Writes a variable-length unsigned integer to the output.
void WriteBinary(byte[] Value)
Writes binary data to the output.
void WriteInt16(short Value)
Writes a 16-bit signed integer to the output.
void WriteGuid(Guid Value)
Writes a Guid to the output.
void WriteUInt8(byte Value)
Writes a 8-bit unsigned integer to the output.
void WriteString(string Value)
Writes a string to the output.
void WriteSingle(float Value)
Writes a single-precision floating point number to the output.
void WriteRaw(byte[] Binary, int Offset, int Count)
Writes raw binary data to the output.
void WriteByte(byte Value)
Writes a byte to the output.
void WriteUInt16(ushort Value)
Writes a 16-bit unsigned integer to the output.
Serializer()
Cluster serializer
void WriteDouble(double Value)
Writes a double-precision floating point number to the output.
void WriteInt64(long Value)
Writes a 64-bit signed integer to the output.