public object Unpack(ArraySegment <byte> packet)
        {
            var header = new Header(packet);

            if (header.Encrypt)
            {
                XorEncrypt.Decrypt(packet.Array, Header.HeadSize - 2, header.BodyLength);
            }

            if (header.Compress)
            {
                var uncompdata = Snappy.Uncompress(packet.Array, Header.HeadSize - 2, header.BodyLength);
                header.Body  = new ArraySegment <byte>(uncompdata, 2, uncompdata.Length - 2);
                header.MsgId = uncompdata[0] | (uint)uncompdata[1] << 8;
            }
            else if (header.Encrypt)
            {
                header.MsgId = packet.Array[packet.Offset + 4] | (uint)packet.Array[packet.Offset + 5] << 8;
            }

            //if (ModuleName == "GameBox.Cratos.GBoxSync")
            //    Debug.LogError("Unpack msgid->" + header.MsgId + " buff len->" + packet.Count + " header.BodyLength->" + header.BodyLength + " header.Encrypt->" + header.Encrypt + " header.Compress->" + header.Compress);

            var msgInfo = msgDefined.GetMsgById(header.MsgId);

            if (msgInfo == null)
            {
                throw new NotSupportedException("Can not find msg info , msg id is [" + header.MsgId + "]");
            }

            var result = packerPolicy.Unpacked(msgInfo, header.Body);

            if (msgInfo.Id != MsgConst.SyncMsgID)
            {
                return(result);
            }

            //MsgService.SyncMsg(result);
            return(null);
        }