Пример #1
0
        public Byte[] Encode(string key)
        {
            Push(VUInt16.Instance.Encode(MSGIDType.BASEAPP_CLIENT_RELOGIN));
            Push(VString.Instance.Encode(key));

            var result = new Byte[m_unLen];

            Buffer.BlockCopy(m_szBuff, 0, result, 0, m_unLen);
            EndPluto(result);
            if (RPCMsgLogManager.IsRecord)
            {
                RPCMsgLogManager.Send(MSGIDType.BASEAPP_CLIENT_RELOGIN, key);
            }
            return(result);
        }
Пример #2
0
        public Byte[] Encode(Byte[] bytes)
        {
            Push(VUInt16.Instance.Encode(MSGIDType.LOGINAPP_CHECK));
            var str = Util.Utils.FormatMD5(bytes);

            Push(VString.Instance.Encode(str));

            var result = new Byte[m_unLen];

            Buffer.BlockCopy(m_szBuff, 0, result, 0, m_unLen);
            EndPluto(result);
            if (RPCMsgLogManager.IsRecord)
            {
                RPCMsgLogManager.Send(MSGIDType.LOGINAPP_CHECK, str);
            }
            return(result);
        }
Пример #3
0
        /// <summary>
        ///     将远程方法调用编码为二进制数组。
        /// </summary>
        /// <param name="passport">登录帐号</param>
        /// <param name="password">登录密码</param>
        /// <param name="loginArgs">登录类型参数</param>
        /// <returns>编码后的二进制数组</returns>
        public Byte[] Encode(String passport, String password, String loginArgs)
        {
            Push(VUInt16.Instance.Encode(MSGIDType.LOGINAPP_LOGIN));
            Push(VString.Instance.Encode(passport));
            Push(VString.Instance.Encode(password));
            Push(VString.Instance.Encode(loginArgs));

            var result = new Byte[m_unLen];

            Buffer.BlockCopy(m_szBuff, 0, result, 0, m_unLen);
            EndPluto(result);
            if (RPCMsgLogManager.IsRecord)
            {
                RPCMsgLogManager.Send(MSGIDType.LOGINAPP_LOGIN, passport, loginArgs);
            }
            return(result);
        }
Пример #4
0
        /// <summary>
        ///     将远程方法调用编码为二进制数组。
        /// </summary>
        /// <returns>编码后的二进制数组</returns>
        public Byte[] Encode(params string[] args)
        {
            Push(VUInt16.Instance.Encode(MSGIDType.LOGINAPP_LOGIN));
            foreach (var item in args)
            {
                Push(VString.Instance.Encode(item));
            }

            var result = new Byte[m_unLen];

            Buffer.BlockCopy(m_szBuff, 0, result, 0, m_unLen);
            EndPluto(result);
            if (RPCMsgLogManager.IsRecord)
            {
                RPCMsgLogManager.Send(MSGIDType.LOGINAPP_LOGIN, args.PackArray());
            }
            return(result);
        }
Пример #5
0
        /// <summary>
        ///     将远程方法调用编码为二进制数组。
        /// </summary>
        /// <param name="x1"></param>
        /// <param name="y1"></param>
        /// <param name="x2"></param>
        /// <param name="y2"></param>
        /// <param name="x3"></param>
        /// <param name="y3"></param>
        /// <returns>编码后的二进制数组</returns>
        public Byte[] Encode(byte face, ushort x, ushort y, ushort z)
        {
            Push(VUInt16.Instance.Encode(MSGIDType.BASEAPP_CLIENT_MOVE_REQ));
            Push(VUInt8.Instance.Encode(face));
            Push(VUInt16.Instance.Encode(x));
            Push(VUInt16.Instance.Encode(y));
            Push(VUInt16.Instance.Encode(z));

            var result = new Byte[m_unLen];

            Buffer.BlockCopy(m_szBuff, 0, result, 0, m_unLen);
            EndPluto(result);
            if (RPCMsgLogManager.IsRecord)
            {
                RPCMsgLogManager.Send(MSGIDType.BASEAPP_CLIENT_MOVE_REQ, x, y);
            }
            return(result);
        }
Пример #6
0
        /// <summary>
        ///     将远程方法调用编码为二进制数组。
        /// </summary>
        /// <param name="args">参数列表</param>
        /// <returns>编码后的二进制数组</returns>
        public Byte[] Encode(params Object[] args)
        {
            var entityDef = CurrentEntity; //DefParser.Instance.GetEntityByName(EntityName);

            if (entityDef == null)
            {
                throw new DefineParseException(String.Format("Encode error: CurrentEntity is null."));
            }

            var method = svrMethod;

            FuncID   = method.FuncID;
            FuncName = method.FuncName;

            if (method.ArgsType.Count != args.Length)
            {
                throw new DefineParseException(
                          String.Format(
                              "Encode error: The number of parameters is not match. func: {0}, require num: {1}, current num: {2}.",
                              FuncID, method.ArgsType.Count, args.Length));
            }
            Push(VUInt16.Instance.Encode(MSGIDType.BASEAPP_CLIENT_RPCALL)); // 指定 pluto 类型为 rpc
            Push(VUInt16.Instance.Encode(FuncID));                          // 指定 调用的 func 标识
            for (var i = 0; i < args.Length; i++)
            {
                Push(method.ArgsType[i].Encode(args[i])); // 增加参数
            }

            var result = new Byte[m_unLen];

            Buffer.BlockCopy(m_szBuff, 0, result, 0, m_unLen);
            EndPluto(result);
            if (RPCMsgLogManager.IsRecord)
            {
                var list = new List <object>(2 + args.Length);
                list.Add(FuncID);
                list.Add(FuncName);
                list.AddRange(args);
                RPCMsgLogManager.Send(MSGIDType.BASEAPP_CLIENT_RPCALL, list.ToArray());
            }
            return(result);
        }