예제 #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);
        }
예제 #2
0
        static void OperationEcho(CardPeer self, OperationRequest request, SendParameters sendParameters)
        {
            if (!Operations.Validate(request))
            {
                return;
            }
            string words    = (string)request[0];
            var    response = new OperationResponse(request.OperationCode);

            response.Parameters = new Dictionary <byte, object>()
            {
                { 0, words },
            };
            self.SendOperationResponse(response, sendParameters);
        }
예제 #3
0
        static void MsgLoadPacketResult(CardPeer self, Message msg)
        {
            FileRecord        file     = msg.Param as FileRecord;
            OperationResponse response = new OperationResponse((byte)Operations.Codes.OP_DOWNLOAD_PACKET);

            if (file != null)
            {
                response.Parameters = new Dictionary <byte, object>()
                {
                    { 0, file.Revision },
                    { 1, file.Content },
                };
            }
            else
            {
                response.Parameters = new Dictionary <byte, object>()
                {
                    { 0, 0 },
                };
            }
            self.SendOperationResponse(response, new SendParameters());
        }
예제 #4
0
        static void MsgLoginResult(CardPeer self, Message msg)
        {
            int result;

            if (msg.Param is GameUser)
            {
                self._gameUser = (GameUser)msg.Param;
                result         = 0;
            }
            else
            {
                self._gameUser = null;
                result         = 1;
            }
            OperationResponse response = new OperationResponse((byte)Operations.Codes.OP_LOGIN);

            response.Parameters = new Dictionary <byte, object>()
            {
                { 0, (object)result },
            };
            self.SendOperationResponse(response, new SendParameters());
        }