public void LoadPlayer(PlayerParticipantStatsSummary p, string name, string champion, ref TeamStats ts)
        {
            double     k, d, a;
            RawStatDTO rd = GetRawStat("LEVEL", p);

            if (rd != null)
            {
                this.summoner.Text = rd.Value.ToString() + ". " + name;
            }
            else
            {
                this.summoner.Text = name;
            }
            k = GetRawStat("CHAMPIONS_KILLED", p).Value;
            d = GetRawStat("NUM_DEATHS", p).Value;
            a = GetRawStat("ASSISTS", p).Value;

            ts.Kill    += (int)k;
            ts.Deaths  += (int)d;
            ts.Assists += (int)a;

            KDAlb.Text  = k.ToString() + " / " + d.ToString() + " / " + a.ToString();
            champplayed = champion;
            if (File.Exists(Application.StartupPath + @"\Champions\" + champion + ".png"))
            {
                this.Champion.BackgroundImage = Image.FromFile(Application.StartupPath + @"\Champions\" + champion + ".png");
            }
            else
            {
                this.Champion.BackgroundImage = Ghostblade.Properties.Resources.Unknown;
            }

            this.Spell1.BackgroundImage = Image.FromFile(Application.StartupPath + @"\Spells\" + p.Spell1Id.ToString() + ".png");
            this.Spell2.BackgroundImage = Image.FromFile(Application.StartupPath + @"\Spells\" + p.Spell2Id.ToString() + ".png");
            SetItem(item1, (int)GetRawStat("ITEM0", p).Value);
            SetItem(item2, (int)GetRawStat("ITEM1", p).Value);
            SetItem(item3, (int)GetRawStat("ITEM2", p).Value);
            SetItem(item4, (int)GetRawStat("ITEM3", p).Value);
            SetItem(item5, (int)GetRawStat("ITEM4", p).Value);
            SetItem(item6, (int)GetRawStat("ITEM5", p).Value);
            SetItem(item7, (int)GetRawStat("ITEM6", p).Value);

            // Gold
            rd = GetRawStat("GOLD_EARNED", p);
            if (rd != null)
            {
                this.goldlb.Text = GoldToString(rd.Value);
            }
            else
            {
                this.goldlb.Text = "$ 0";
            }
            // Creeps
            int totalfarm = 0;

            rd = GetRawStat("MINIONS_KILLED", p);
            if (rd != null)
            {
                totalfarm         += (int)rd.Value;
                this.creepslb.Text = rd.Value.ToString();
                ts.CREEPS         += (int)rd.Value;
            }
            else
            {
                this.creepslb.Text = "0";
            }


            rd = GetRawStat("NEUTRAL_MINIONS_KILLED", p);
            if (rd != null)
            {
                ts.CREEPS         += (int)rd.Value;
                totalfarm         += (int)rd.Value;
                this.creepslb.Text = totalfarm.ToString();
            }

            // Ward placed
            rd = GetRawStat("WARD_PLACED", p);
            if (rd != null)
            {
                this.wardplacedlb.Text = rd.Value.ToString();
                ts.WP += (int)rd.Value;
            }
            else
            {
                this.wardplacedlb.Text = "0";
            }
            // Ward killed
            rd = GetRawStat("WARD_KILLED", p);
            if (rd != null)
            {
                this.wardkilledlb.Text = rd.Value.ToString();
                ts.WD += (int)rd.Value;
            }
            else
            {
                this.wardkilledlb.Text = "0";
            }
            // Turrets destoryed
            rd = GetRawStat("TURRETS_KILLED", p);
            if (rd != null)
            {
                this.Turretdestlb.Text = rd.Value.ToString();
                ts.TD += (int)rd.Value;
            }
            else
            {
                this.Turretdestlb.Text = "0";
            }
            // Dmg taken
            rd = GetRawStat("TOTAL_DAMAGE_TAKEN", p);
            if (rd != null)
            {
                this.dmgtakenlb.Text = DmgToString(rd.Value);
            }
            else
            {
                this.dmgtakenlb.Text = "0";
            }

            // Dmg dealt
            rd = GetRawStat("TOTAL_DAMAGE_DEALT", p);
            if (rd != null)
            {
                this.dmgdealtlb.Text = DmgToString(rd.Value);
            }
            else
            {
                this.dmgdealtlb.Text = "0";
            }

            // Largest Killing spree
            double lks = 0;

            rd = GetRawStat("LARGEST_KILLING_SPREE", p);
            if (rd != null)
            {
                lks = rd.Value;
            }
            else
            {
                lks = 0;
            }
            // Largest Multi Kill
            double lmk = 0;

            rd = GetRawStat("LARGEST_MULTI_KILL", p);
            if (rd != null)
            {
                lmk = rd.Value;
            }
            else
            {
                lmk = 0;
            }

            lmkslb.Text = lmk.ToString() + " | " + lks.ToString();
            this.Refresh();
        }
        public void LoadGame(EndOfGameStats eog, GameMetaData meta, BasicInfo pi, bool bluewin)
        {
            try
            {
                //   RiotSharp.MatchEndpoint.MatchDetail m = Program.MainFormInstance.API.GetMatch(RiotTool.PlatformToRegion(meta.gameKey.platformId), (long)eog.GameId);

                TeamStats blueteam = new TeamStats();
                TeamStats redteam  = new TeamStats();
                BluePanel.Controls.Clear();
                RedPanel.Controls.Clear();
                if (!bluewin)
                {
                    metroLabel1.Text  = "Red Team Wins";
                    metroLabel1.Style = MetroFramework.MetroColorStyle.Red;
                }
                if (meta.gameKey.platformId != "PBE1")
                {
                    ginfo.Text = RiotTool.ToMapString((RiotSharp.MapType)pi.Map) + ", " + RiotTool.ToQueueString((QueueType)pi.Queue) + " - " + RiotTool.PlatformToRegion(meta.gameKey.platformId).ToString().ToUpper();
                }
                else
                {
                    ginfo.Text = eog.GameMode + ", " + eog.GameType.Replace("_", " ") + " - " + RiotTool.PlatformToRegion(meta.gameKey.platformId).ToString().ToUpper();
                }
                if (eog != null)
                {
                    foreach (PlayerParticipantStatsSummary p in eog.TeamPlayerParticipantStats)
                    {
                        Player2Ctrl p2 = new Player2Ctrl(p.TeamId == 200);

                        p2.LoadPlayer(p, p.SummonerName, p.SkinName, ref blueteam);
                        p2.Dock = DockStyle.Top;
                        if (p.TeamId == 100)
                        {
                            BluePanel.Controls.Add(p2);
                        }
                        else
                        {
                            RedPanel.Controls.Add(p2);
                        }
                    }
                    foreach (PlayerParticipantStatsSummary p in eog.OtherTeamPlayerParticipantStats)
                    {
                        Player2Ctrl p2 = new Player2Ctrl(p.TeamId == 200);

                        p2.LoadPlayer(p, p.SummonerName, p.SkinName, ref redteam);
                        p2.Dock = DockStyle.Top;
                        if (p.TeamId == 100)
                        {
                            BluePanel.Controls.Add(p2);
                        }
                        else
                        {
                            RedPanel.Controls.Add(p2);
                        }
                    }
                }

                bluewk.Text     = blueteam.WD.ToString();
                bluewp.Text     = blueteam.WP.ToString();
                bluecreeps.Text = blueteam.CREEPS.ToString();
                bluekda.Text    = blueteam.Kill + " / " + blueteam.Deaths + " / " + blueteam.Assists;
                bluetd.Text     = blueteam.TD.ToString();

                redwk.Text     = redteam.WD.ToString();
                redwp.Text     = redteam.WP.ToString();
                redcreeps.Text = redteam.CREEPS.ToString();
                redkda.Text    = redteam.Kill + " / " + redteam.Deaths + " / " + redteam.Assists;
                redtd.Text     = redteam.TD.ToString();

                BluePanel.Controls.Add(panel5);
                RedPanel.Controls.Add(panel4);
            }
            catch (Exception ex)
            {
                Logger.Instance.Log.Error("Failed to load game", ex);
            }
        }