private void loginButton_Click(object sender, EventArgs e)
        {
            if (!ValidLoginInput())
                return;

            try {
                TcpClient client = new TcpClient();
                client.Connect(ipAddress, port);
                Connection conn = new Connection(client, true);

                conn.SendData(new AuthenticationRequest(GetUsername(), GetPassword()));

                AuthenticationResponse authentication = (AuthenticationResponse)conn.ReceiveData();

                if (authentication.Message == null) {
                    ConnectionsRepository.AddConnection(conn, true);
                    conn.DataTransfered += DataProcessor.ProcessData;
                    conn.InitializeDataListener();

                    this.Visible = false;
                    this.ShowInTaskbar = false;

                    GameForm game = new GameForm(conn);
                    conn.ShutdownRequest += ServerDown;
                    game.FormClosed += CloseClient;
                    game.Show();
                } else
                    noteLabel.Text = authentication.Message;

            } catch {
                noteLabel.Text = "No response from server.";
            }
        }
        public static void ProcessData(Connection conn, DataTransfer transfer)
        {
            if (conn == null || transfer == null)
                return;

            if (transfer is AuthenticationRequest) {
                AuthenticationRequest authenticationRequest = (AuthenticationRequest)transfer;
                PlayerAccount player = new PlayerAccount(authenticationRequest.Username, authenticationRequest.Password);
                string authenticationResponseMessage = AccountFileHandler.ReadAccount(player);

                if (authenticationResponseMessage == null)
                    PlayerHandler.AddPlayer(player);

                conn.SendData(new AuthenticationResponse(authenticationResponseMessage));
            }
        }