Beispiel #1
0
        private unsafe void deSerialize(AutoCSer.BinarySerialize.DeSerializer deSerializer)
        {
            byte *read = deSerializer.Read;
            int   size = *(int *)read;

            if (size <= 0)
            {
                if (size == 0)
                {
                    Buffer.Null();
                    State              = (MemberState)(byte)*(int *)(read + sizeof(int));
                    deSerializer.Read += sizeof(int) * 2;
                }
                else
                {
                    Buffer.Start       = -size;
                    deSerializer.Read += sizeof(int);
                }
            }
            else if (size == Buffer.Length)
            {
                if (deSerializer.VerifyRead(sizeof(int) + size + (-size & 3)))
                {
                    fixed(byte *bufferFixed = Buffer.Array) AutoCSer.Memory.CopyNotNull(read + sizeof(int), bufferFixed + Buffer.Start, size);

                    State = MemberState.Remote;
                }
            }
            else
            {
                deSerializer.State = BinarySerialize.DeSerializeState.IndexOutOfRange;
            }
        }
Beispiel #2
0
 private unsafe void deSerialize(AutoCSer.BinarySerialize.DeSerializer deSerializer)
 {
     if (deSerializer.VerifyRead(sizeof(ulong) * 4))
     {
         byte *dataStart = deSerializer.Read;
         Ticks    = *(ulong *)(dataStart - sizeof(ulong) * 4);
         Identity = *(ulong *)(dataStart - sizeof(ulong) * 3);
         Low      = *(ulong *)(dataStart - sizeof(ulong) * 2);
         High     = *(ulong *)(dataStart - sizeof(ulong));
     }
 }
Beispiel #3
0
        private unsafe void deSerialize(AutoCSer.BinarySerialize.DeSerializer deSerializer)
        {
            byte *read = deSerializer.Read;
            int   size = *(int *)read;

            if (size > 0)
            {
                int offset = -(size + sizeof(ushort)) & 3;
                if (deSerializer.VerifyRead(size + offset + (sizeof(int) + sizeof(ulong) + sizeof(ushort))))
                {
                    Index = *(ulong *)(read + sizeof(int));
                    deSerializer.DeSerializeTcpServer(ref Buffer, read += sizeof(int) + sizeof(ulong), size);
                    BlockIndex = *(ushort *)(read + size);
                }
            }
            else
            {
                deSerializer.State = BinarySerialize.DeSerializeState.IndexOutOfRange;
            }
        }
Beispiel #4
0
        private static unsafe void deSerialize(AutoCSer.BinarySerialize.DeSerializer deSerializer, ref CustomClass value)
        {
            byte *read = deSerializer.CustomRead;

            if (deSerializer.VerifyRead(sizeof(int)))
            {
                switch (*(int *)read)
                {
                case 1: value = new CustomClass {
                        Value = null
                }; return;

                case 2: value = new CustomClass {
                        Value = string.Empty
                }; return;

                default: deSerializer.MoveRead(-1); return;
                }
            }
        }