示例#1
0
        public void ReadyToSendPicture(Connection connection, Request request)
        {
            picture          = string.Empty;
            picturesUsername = request.Username();
            extension        = request.PictureExtension();

            connection.SendMessage(BuildResponse(ResponseCode.Ok));
        }
示例#2
0
        public void ConnectClient(Connection connection, Request request)
        {
            try
            {
                var    client = new Client(request.Username(), request.Password());
                string token  = gameLogic.Login(client);

                object[] response = string.IsNullOrEmpty(token)
                    ? BuildResponse(ResponseCode.NotFound, "Client not found. Wrong username or password.")
                    : BuildResponse(ResponseCode.Ok, token);
                connection.SendMessage(response);
            }
            catch (ClientAlreadyConnectedException e)
            {
                connection.SendMessage(BuildResponse(ResponseCode.Forbidden, e.Message));
            }
        }