Example #1
0
        //登录信息
        private object LoginRequestDecodeParser(byte[] bytes)
        {
            byte[] messageBytes = bytes;

            messageBytes = SnappySharp.Uncompress(messageBytes);

            messageBytes = AESCrypto.Decrypt(messageBytes, SecretKey, SecretVector);

            string jsonStr = Encoding.UTF8.GetString(messageBytes);

            return(JsonConvert.DeserializeObject(jsonStr, typeof(LoginRequest)));
        }
Example #2
0
        //返回商店物品列表
        private byte[] ShopListResponseEncodeParser(object message)
        {
            string jsonStr = JsonConvert.SerializeObject(message, Formatting.None);

            byte[] messageBytes = Encoding.UTF8.GetBytes(jsonStr);

            messageBytes = AESCrypto.Encrypt(messageBytes, SecretKey, SecretVector);

            messageBytes = SnappySharp.Compress(messageBytes);

            return(messageBytes);
        }