Exemple #1
0
        static void OperationUploadPacket(CardPeer self, OperationRequest request, SendParameters send)
        {
            if (!Operations.Validate(request))
            {
                return;
            }
            if (self._gameUser == null)
            {
                return;
            }
            OperationResponse response = new OperationResponse(request.OperationCode);
            byte ret = 0;

            if (0 == (self._gameUser.Auth & (uint)UserAuth.DESIGNER))
            {
                ret = 1;
            }
            else
            {
                CardServer app = (CardServer)(ApplicationBase.Instance);
                Message    msg = new Message((byte)UserCenter.MessageCodes.MSG_SAVE_PACKET);
                msg.Param = request[0];
                app.Center.SendMessage(msg);
            }
            response.Parameters = new Dictionary <byte, object>()
            {
                { 0, ret },
            };
            self.SendOperationResponse(response, send);
        }
Exemple #2
0
        static void OperationLogin(CardPeer self, OperationRequest request, SendParameters sendParameters)
        {
            if (!Operations.Validate(request))
            {
                return;
            }
            string usr, pwd;

            usr  = (string)request[0];
            pwd  = (string)request[1];
            pwd += "FANCY;STAR";
            MD5 md5hash = MD5.Create();

            byte []       data    = md5hash.ComputeHash(Encoding.UTF8.GetBytes(pwd));
            StringBuilder builder = new StringBuilder();

            for (int i = 0; i < data.Length; ++i)
            {
                builder.Append(data[i].ToString("x2"));
            }
            pwd = builder.ToString();

            ArrayList al = new ArrayList();

            al.Add(self);
            al.Add(usr);
            al.Add(pwd);
            Message msg = new Message((byte)UserCenter.MessageCodes.MSG_LOGIN);

            msg.Param = al;
            CardServer app = (CardServer)(ApplicationBase.Instance);

            app.Center.SendMessage(msg);
        }
Exemple #3
0
        static void OperationDownloadPacket(CardPeer self, OperationRequest request, SendParameters send)
        {
            if (!Operations.Validate(request))
            {
                return;
            }
            if (self._gameUser == null)
            {
                return;
            }
            CardServer app = (CardServer)(ApplicationBase.Instance);
            Message    msg = new Message((byte)UserCenter.MessageCodes.MSG_LOAD_PACKET);

            msg.Param = request[0];
            app.Center.SendMessage(msg);
        }
Exemple #4
0
        static void OperationLogout(CardPeer self, OperationRequest request, SendParameters sendParameters)
        {
            if (!Operations.Validate(request))
            {
                return;
            }
            if (self._gameUser == null)
            {
                return;
            }
            CardServer app = (CardServer)(ApplicationBase.Instance);
            Message    msg = new Message((byte)UserCenter.MessageCodes.MSG_LOGOUT);

            msg.Param = self._gameUser.Email;
            app.Center.SendMessage(msg);
            self._gameUser = null;
        }