示例#1
0
        public int Serialize(ref Span <byte> buffer)
        {
            var index = 0;

            for (var i = 0; i < ArD.Length; i++)
            {
                BinSerialize.WriteDouble(ref buffer, ArD[i]); index += 8;
            }
            BinSerialize.WriteUInt(ref buffer, V3); index += 4;
            for (var i = 0; i < ArU32.Length; i++)
            {
                BinSerialize.WriteUInt(ref buffer, ArU32[i]); index += 4;
            }
            for (var i = 0; i < ArI32.Length; i++)
            {
                BinSerialize.WriteInt(ref buffer, ArI32[i]); index += 4;
            }
            for (var i = 0; i < ArF.Length; i++)
            {
                BinSerialize.WriteFloat(ref buffer, ArF[i]); index += 4;
            }
            BinSerialize.WriteUShort(ref buffer, V2); index += 2;
            for (var i = 0; i < ArU16.Length; i++)
            {
                BinSerialize.WriteUShort(ref buffer, ArU16[i]); index += 2;
            }
            for (var i = 0; i < ArI16.Length; i++)
            {
                BinSerialize.WriteShort(ref buffer, ArI16[i]); index += 2;
            }
            BinSerialize.WriteByte(ref buffer, (byte)V1); index += 1;
            for (var i = 0; i < ArU8.Length; i++)
            {
                BinSerialize.WriteByte(ref buffer, (byte)ArU8[i]); index += 1;
            }
            for (var i = 0; i < ArI8.Length; i++)
            {
                BinSerialize.WriteByte(ref buffer, (byte)ArI8[i]); index += 1;
            }
            unsafe
            {
                fixed(byte *bytePointer = buffer)
                fixed(char *charPointer = ArC)
                {
                    Encoding.ASCII.GetBytes(charPointer, ArC.Length, bytePointer, ArC.Length);
                }
            }
            buffer = buffer.Slice(ArC.Length);
            index += ArC.Length;
            return(index); // /*PayloadByteSize*/91;
        }
示例#2
0
        public int Serialize(ref Span <byte> buffer)
        {
            var index = 0;

            for (var i = 0; i < ArD.Length; i++)
            {
                BinSerialize.WriteDouble(ref buffer, ArD[i]); index += 8;
            }
            BinSerialize.WriteUInt(ref buffer, V3); index += 4;
            for (var i = 0; i < ArU16.Length; i++)
            {
                BinSerialize.WriteUShort(ref buffer, ArU16[i]); index += 2;
            }
            return(index); // /*PayloadByteSize*/24;
        }
示例#3
0
 protected override void SerializeValue(ref Span <byte> buffer, double value)
 {
     BinSerialize.WriteDouble(ref buffer, value);
 }
示例#4
0
 public override void Serialize(ref Span <byte> buffer)
 {
     base.Serialize(ref buffer);
     BinSerialize.WriteDouble(ref buffer, RawValue);
 }
示例#5
0
        public int Serialize(ref Span <byte> buffer)
        {
            var index = 0;

            BinSerialize.WriteULong(ref buffer, U64); index += 8;
            BinSerialize.WriteLong(ref buffer, S64); index  += 8;
            BinSerialize.WriteDouble(ref buffer, D); index  += 8;
            for (var i = 0; i < U64Array.Length; i++)
            {
                BinSerialize.WriteULong(ref buffer, U64Array[i]); index += 8;
            }
            for (var i = 0; i < S64Array.Length; i++)
            {
                BinSerialize.WriteLong(ref buffer, S64Array[i]); index += 8;
            }
            for (var i = 0; i < DArray.Length; i++)
            {
                BinSerialize.WriteDouble(ref buffer, DArray[i]); index += 8;
            }
            BinSerialize.WriteUInt(ref buffer, U32); index += 4;
            BinSerialize.WriteInt(ref buffer, S32); index  += 4;
            BinSerialize.WriteFloat(ref buffer, F); index  += 4;
            for (var i = 0; i < U32Array.Length; i++)
            {
                BinSerialize.WriteUInt(ref buffer, U32Array[i]); index += 4;
            }
            for (var i = 0; i < S32Array.Length; i++)
            {
                BinSerialize.WriteInt(ref buffer, S32Array[i]); index += 4;
            }
            for (var i = 0; i < FArray.Length; i++)
            {
                BinSerialize.WriteFloat(ref buffer, FArray[i]); index += 4;
            }
            BinSerialize.WriteUShort(ref buffer, U16); index += 2;
            BinSerialize.WriteShort(ref buffer, S16); index  += 2;
            for (var i = 0; i < U16Array.Length; i++)
            {
                BinSerialize.WriteUShort(ref buffer, U16Array[i]); index += 2;
            }
            for (var i = 0; i < S16Array.Length; i++)
            {
                BinSerialize.WriteShort(ref buffer, S16Array[i]); index += 2;
            }
            BinSerialize.WriteByte(ref buffer, (byte)C); index += 1;
            unsafe
            {
                fixed(byte *bytePointer = buffer)
                fixed(char *charPointer = S)
                {
                    Encoding.ASCII.GetBytes(charPointer, S.Length, bytePointer, S.Length);
                }
            }
            buffer = buffer.Slice(S.Length);
            index += S.Length;
            BinSerialize.WriteByte(ref buffer, (byte)U8); index += 1;
            BinSerialize.WriteByte(ref buffer, (byte)S8); index += 1;
            for (var i = 0; i < U8Array.Length; i++)
            {
                BinSerialize.WriteByte(ref buffer, (byte)U8Array[i]); index += 1;
            }
            for (var i = 0; i < S8Array.Length; i++)
            {
                BinSerialize.WriteByte(ref buffer, (byte)S8Array[i]); index += 1;
            }
            return(index); // /*PayloadByteSize*/179;
        }
示例#6
0
 public void Serialize(ref Span <byte> buffer)
 {
     BinSerialize.WritePackedUnsignedInteger(ref buffer, Uint1);
     BinSerialize.WriteDouble(ref buffer, Double1);
     BinSerialize.WriteString(ref buffer, String);
 }