Beispiel #1
0
        /// <summary>
        /// 获取操作数据
        /// </summary>
        /// <param name="deSerializer"></param>
        /// <returns></returns>
        internal static Buffer GetOperationData(AutoCSer.BinaryDeSerializer deSerializer)
        {
            byte *read = deSerializer.Read;
            int   size = *(int *)read;

            if (deSerializer.MoveRead(size))
            {
                Buffer buffer = BufferCount.GetBuffer(size);
                deSerializer.CopyTo(read, ref buffer.Array);
                return(buffer);
            }
            return(null);
        }
Beispiel #2
0
        private unsafe void deSerialize(AutoCSer.BinaryDeSerializer deSerializer)
        {
            byte *read = deSerializer.Read;
            int   size = *(int *)read;

            if (deSerializer.MoveRead(size))
            {
                Identity = new ShortPathIdentity(read + Serializer.HeaderSize);
                int bufferSize = size + Identity.PacketSize - ShortPathIdentity.SerializeSize;
                if (bufferSize >= Serializer.HeaderSize + IndexIdentity.SerializeSize)
                {
                    Buffer = BufferCount.GetBuffer(bufferSize);
                    fixed(byte *bufferFixed = Buffer.GetFixedBuffer())
                    {
                        byte *start = bufferFixed + Buffer.Array.Start;

                        *(int *)start = Buffer.Array.Length;
                        *(uint *)(start + sizeof(int)) = *(uint *)(read + sizeof(int));
                    }

                    deSerializer.CopyTo(read + (Serializer.HeaderSize + ShortPathIdentity.SerializeSize), ref Buffer.Array, Serializer.HeaderSize + Identity.PacketSize);
                }
            }
        }