예제 #1
0
        //public List<Match> LoadMatches(string[] logLines)
        //{
        //}

        public Match LoadMatch(string[] logLines)
        {
            var match = new Match();

            match.Start   = GetStart(logLines);
            match.Number  = GetNumber(logLines);
            match.Players = GetPlayers(logLines, match);
            match.End     = GetEnd(logLines, match);

            return(match);
        }
예제 #2
0
        private static DateTime GetEnd(string[] logLines, Match match)
        {
            //string endMatch = string.Format("Match {0} has ended" ,match.Number);
            var      penultimate = logLines.Length - 2;
            DateTime?dateEnd     = GetDate(logLines[penultimate]);

            if (dateEnd != null)
            {
                return(dateEnd.Value);
            }

            throw new Exception("No end detected.");
        }
예제 #3
0
        public List <PlayerMatch> GetPlayers(string[] logLines, Match match)
        {
            var players = match.Players ?? new List <PlayerMatch>();

            for (int count = 1; count < logLines.Length - 1; count++)
            {
                if (ValidKill(logLines[count], match.Number))
                {
                    var playerKiller = AddKiller(logLines, count);
                    var playerVictim = AddVictim(logLines, count);

                    players = AddPlayer(players, playerKiller);
                    players = AddPlayer(players, playerVictim);
                }
            }

            return(players);
        }
예제 #4
0
        private static void GetAwards(Match game)
        {
            var players = game.Players.OrderByDescending(p => p.Kills.Count).ToList();

            game.Players = players;

            foreach (var player in game.Players)
            {
                if (player.Kills.Count > 0)
                {
                    GetFavoriteGun(player);
                }

                if (player.Kills.Count >= 5)
                {
                    GetOverkill(player);
                }
            }
        }