Esempio n. 1
0
        public PackageWriter(byte[] data, int size)
        {
            int realBufferSize = size + 128;

            mHandle   = new byte[realBufferSize];
            mBuffSize = realBufferSize - RPCHeader.SizeOf();
            mPos      = size - RPCHeader.SizeOf();
            Buffer.BlockCopy(data, 0, mHandle, 0, size);
            mStack = 0;

            //int realBufferSize = size + 128;
            //mPointer = new BYTE[realBufferSize];
            //mBuffSize = realBufferSize - sizeof(RPCHeader);
            //mPos = size - sizeof(RPCHeader);
            //memcpy(mPointer, pData, size);
            //mStack = 0;
        }
Esempio n. 2
0
        public void FixSize(int growSize)
        {
            if (growSize >= C_MAXDATASIZE)
            {
                throw new Exception("OutOfMemory By DataWrite FixSIze");
            }
            int nsize = mPos + growSize;

            if (nsize > mBuffSize)
            {
                nsize += mBuffSize / 2;
                byte[] nBuffer = new byte[nsize + RPCHeader.SizeOf()];
                Buffer.BlockCopy(mHandle, 0, nBuffer, 0, mPos + RPCHeader.SizeOf());
                mHandle   = nBuffer;
                mBuffSize = nsize;
            }
        }
Esempio n. 3
0
        public PackageWriter()
        {
            mHandle = new byte[128 + RPCHeader.SizeOf()];
            unsafe
            {
                fixed(byte *ptr = &mHandle[0])
                {
                    RPC.RPCHeader *header = (RPC.RPCHeader *)ptr;
                    header->ToDefault();
                }
            }

            mBuffSize = 128;
            mStack    = mPos = 0;

            //mPointer = new BYTE[128 + sizeof(RPCHeader)];
            //GetHeader()->ToDefault();
            //mBuffSize = 128;
            //mStack = mPos = 0;
        }
Esempio n. 4
0
 public int CurPtr()
 {
     return(RPCHeader.SizeOf() + mPos);
 }
Esempio n. 5
0
 public int DataPtr()
 {
     return(RPCHeader.SizeOf());
 }