Esempio n. 1
0
        private void AddMatch(MatchData matchData)
        {
            var regex = new Regex(@"^([0-9].11)");
            var match = new InitialDataUpload.Models.Match();

            match.MatchId      = matchData.matchId;
            match.Is_Ranked    = matchData.queueType.Equals("RANKED_SOLO_5x5");
            match.Match_Region = dictRegion[matchData.region];
            match.Pre_Change   = regex.IsMatch(matchData.matchVersion);
            match.Players      = new List <Player>();

            foreach (InitialDataUpload.Models.Participant participant in matchData.participants)
            {
                var itemsBought = string.Format("{0},{1},{2},{3},{4},{5},{6}",
                                                participant.stats.item0,
                                                participant.stats.item1,
                                                participant.stats.item2,
                                                participant.stats.item3,
                                                participant.stats.item4,
                                                participant.stats.item5,
                                                participant.stats.item6);

                var player = new Player
                {
                    Rank                = dictRank[participant.highestAchievedSeasonTier],
                    Region              = dictRegion[matchData.region],
                    Winner              = participant.stats.winner,
                    ItemsBought         = itemsBought,
                    Kills               = participant.stats.kills,
                    Deaths              = participant.stats.deaths,
                    Assists             = participant.stats.assists,
                    TripleKills         = participant.stats.tripleKills,
                    QuadraKills         = participant.stats.quadraKills,
                    PentaKills          = participant.stats.pentaKills,
                    MagicDamageDealt    = participant.stats.magicDamageDealt,
                    LargestKillingSpree = participant.stats.largestKillingSpree
                };

                player.ChampionUsed = MatchesContext.Champions.Where(c => c.ChampionId == participant.championId).Single();
                match.Players.Add(player);
            }

            match.Highest_Rank = (Rank)match.Players.Select(p => p.Rank).Max();

            Matches.Add(match);
        }
Esempio n. 2
0
        private void AddMatch(MatchData matchData)
        {
            var regex = new Regex(@"^([0-9].11)");
            var match = new InitialDataUpload.Models.Match();
            match.MatchId = matchData.matchId;
            match.Is_Ranked = matchData.queueType.Equals("RANKED_SOLO_5x5");
            match.Match_Region = dictRegion[matchData.region];
            match.Pre_Change = regex.IsMatch(matchData.matchVersion);
            match.Players = new List<Player>();

            foreach (InitialDataUpload.Models.Participant participant in matchData.participants)
            {
                var itemsBought = string.Format("{0},{1},{2},{3},{4},{5},{6}",
                    participant.stats.item0,
                    participant.stats.item1,
                    participant.stats.item2,
                    participant.stats.item3,
                    participant.stats.item4,
                    participant.stats.item5,
                    participant.stats.item6);

                var player = new Player
                {
                    Rank = dictRank[participant.highestAchievedSeasonTier],
                    Region = dictRegion[matchData.region],
                    Winner = participant.stats.winner,
                    ItemsBought = itemsBought,
                    Kills = participant.stats.kills,
                    Deaths = participant.stats.deaths,
                    Assists = participant.stats.assists,
                    TripleKills = participant.stats.tripleKills,
                    QuadraKills = participant.stats.quadraKills,
                    PentaKills = participant.stats.pentaKills,
                    MagicDamageDealt = participant.stats.magicDamageDealt,
                    LargestKillingSpree = participant.stats.largestKillingSpree
                };

                player.ChampionUsed = MatchesContext.Champions.Where(c => c.ChampionId == participant.championId).Single();
                match.Players.Add(player);
            }

            match.Highest_Rank = (Rank)match.Players.Select(p => p.Rank).Max();

            Matches.Add(match);
        }