public TdrError.ErrorType pack(ref byte[] buffer, int size, ref int usedSize, uint cutVer)
        {
            if (buffer == null || buffer.GetLength(0) == 0 || size > buffer.GetLength(0))
            {
                return(TdrError.ErrorType.TDR_ERR_INVALID_BUFFER_PARAMETER);
            }
            TdrWriteBuf tdrWriteBuf = ClassObjPool <TdrWriteBuf> .Get();

            tdrWriteBuf.set(ref buffer, size);
            TdrError.ErrorType errorType = this.pack(ref tdrWriteBuf, cutVer);
            if (errorType == TdrError.ErrorType.TDR_NO_ERROR)
            {
                buffer   = tdrWriteBuf.getBeginPtr();
                usedSize = tdrWriteBuf.getUsedSize();
            }
            tdrWriteBuf.Release();
            return(errorType);
        }
        public TdrError.ErrorType pack(long selector, ref byte[] buffer, int size, ref int usedSize, uint cutVer)
        {
            if ((buffer.GetLength(0) == 0) || (size > buffer.GetLength(0)))
            {
                return(TdrError.ErrorType.TDR_ERR_INVALID_BUFFER_PARAMETER);
            }
            TdrWriteBuf destBuf = ClassObjPool <TdrWriteBuf> .Get();

            destBuf.set(ref buffer, size);
            TdrError.ErrorType type = this.pack(selector, ref destBuf, cutVer);
            if (type == TdrError.ErrorType.TDR_NO_ERROR)
            {
                buffer   = destBuf.getBeginPtr();
                usedSize = destBuf.getUsedSize();
            }
            destBuf.Release();
            return(type);
        }