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));
            }
        }
        public static string ReadAccount(PlayerAccount player)
        {
            PlayerAccount loadedAccount = null;
            string filePath = FileAccessProperties.PlayerAccountSaveLocation + player.Username + ".dat";

            if (!File.Exists(filePath)) {
                SaveAccount(player);
                return null;
            }

            using (Stream stream = File.Open(FileAccessProperties.PlayerAccountSaveLocation + player.Username + ".dat", FileMode.Open))
                   loadedAccount = (PlayerAccount)FileAccessProperties.Formatter.Deserialize(stream);

             if (loadedAccount.Password != player.Password)
                return "Wrong password.";
            else {
                player = loadedAccount;
                return null;
            }
        }
 public static void RemovePlayer(PlayerAccount player)
 {
     players.Remove(player);
 }
 public static void AddPlayer(PlayerAccount player)
 {
     players.Add(player);
 }
 public static void RemovePlayer(PlayerAccount player)
 {
     players.Remove(player);
 }
 public static void AddPlayer(PlayerAccount player)
 {
     players.Add(player);
 }
 public static void SaveAccount(PlayerAccount player)
 {
     using (Stream stream = File.Open(FileAccessProperties.PlayerAccountSaveLocation + player.Username + ".dat", FileMode.OpenOrCreate))
         FileAccessProperties.Formatter.Serialize(stream, player);
 }