public void LogBattleVictory(BattleResult br) { foreach (Player p in players) { if (p.PlayerID == br.gamePlayer.currentPlayer.PlayerID) { p.Kills += br.NumDefeated; p.Treasures += br.treasuresWon; } if (br.assistedBy != null && p.PlayerID == br.assistedBy.currentPlayer.PlayerID) { p.Assists++; p.Treasures += br.assistTreasures; } } string path = HttpContext.Current.Server.MapPath("~/") + "players.xml"; XmlSerializer serializer = new XmlSerializer(typeof(List <Player>)); if (File.Exists(path)) { using (FileStream stream = File.OpenWrite(path)) { serializer.Serialize(stream, players); } } }