private bool unpack(byte[] data, int start, int length)
        {
            // 解密
            if ((data[start] & QPCipher.getCipherMode()) > 0)
            {
                QPCipher.decryptBuffer(data, start, length);
            }
            // 主命令码
            int main = QPCipher.getMainCommand(data, start);
            // 次命令码
            int sub = QPCipher.getSubConmmand(data, start);

            // 附加数据
            if (length > 8)
            {
                for (int i = 0; i < length - 8; ++i)
                {
                    mBufPack[i] = data[start + 8 + i];
                }
                //memcpy(mBufUnPack, &data[start + 8], length - 8);
            }

            length -= 8;



            //if (SOCKET_CHECK)
            //	PLAZZ_PRINTF("Main:%d Sub:%d Size:%d\n", main, sub, length);



            if (main == 0 && sub == 1)
            {
                //PLAZZ_PRINTF("REV-HEART\n");
            }
            else
            {
                if (mISocketEngineSink != null)
                {
                    bool bHandle = mISocketEngineSink.onEventTCPSocketRead(main, sub, mBufUnPack, length);

                    //if (!bHandle)
                    //	PLAZZ_PRINTF("no match: main:%d sub:%d size:%d\n", main, sub, length);
                    return(bHandle);
                }
            }

            return(true);
        }
        private void sendTCPValidate()
        {
            if (mIsSendTCPValidate == false)
            {
                return;
            }
            // 获取验证信息
            QPCipher.tcpValidate(mBufPack, 0);
            // 发送验证
            string ss = "";

            for (int i = 0; i < QPCipher.SIZE_VALIDATE; i++)
            {
                ss += mBufPack[i];
                ss += ",";
            }
            //mSocket.send(ss, (int)ss.Length);
        }
        private byte[] pack(int main, int sub, byte[] data, int size)
        {
            mBufPack[0] = 0;
            int packsize = HeaderStruct.SIZE_PACK_HEAD + size;

            QPCipher.setPackInfo(mBufPack, packsize, main, sub);

            // 赋值
            if (size > 0)
            {
                for (int i = 0; i < size; ++i)
                {
                    mBufPack[i + HeaderStruct.SIZE_PACK_HEAD] = data[i];
                }
                //memcpy(&mBufPack[SIZE_PACK_HEAD], data, size);
            }
            // 加密数据
            QPCipher.encryptBuffer(mBufPack, packsize);
            return(mBufPack);
        }