/// <summary>
        /// Iterates over match IDs that haven't been processed yet. Check them in date order and update the statistics for each player that is mentioned.
        /// </summary>
        private void GetMatchData()
        {
            List <string> players = context.PlayersWithID().Select(x => x.Name).ToList();
            List <Match>  matches = context.GetUnprocessedMatches();

            foreach (Match m in matches)
            {
                Console.WriteLine("Parsing Match {0}", m.MatchId);
                List <PlayerStat> stats = new List <PlayerStat>();
                JObject           match = api.GetMatches(m.MatchId);
                m.Date = (DateTime)match["data"]["attributes"]["createdAt"];

                foreach (JObject item in match["included"])
                {
                    string type = item["type"].ToString();
                    if (type.Equals("participant") && players.Contains(item["attributes"]["stats"]["name"].ToString()))
                    {
                        stats.Add(ParsePlayer(item["attributes"]["stats"], m.MatchId));
                    }
                    if (type.Equals("asset") && item["attributes"]["URL"] != null)
                    {
                        m.TelemetryUrl = item["attributes"]["URL"].ToString();
                    }
                }
                context.SaveMatch(m, stats);
            }
            Console.WriteLine("Match Parsing Complete.");
        }
Exemple #2
0
        public void MatchTest()
        {
            ApiRepository conn     = new ApiRepository();
            var           result   = conn.GetMatches(new Guid("2c15e0f6-87dc-44d7-96ff-3edc2f720803"));
            string        gamemode = result["data"]["attributes"]["gameMode"].ToString();

            Assert.IsTrue(gamemode.Equals("solo-fpp"));
        }