public FriendStats(string name, StatsReader r) { InitializeComponent(); this.nameval.Text = "\"" + name + "\""; //this.plyrlvl.Text = r. this.assistsval.Text = r.assists.ToString(); this.deathsval.Text = r.deaths.ToString(); this.headshotsval.Text = r.headshots.ToString(); this.hitsval.Text = r.hits.ToString(); this.killsval.Text = r.kills.ToString(); this.lasttplayedval.Text = new DateTime(1970, 1, 1).AddSeconds(r.last_play).ToString(); this.lossesval.Text = r.losses.ToString(); this.missesval.Text = r.misses.ToString(); this.prestigelvl.Text = r.prestige.ToString(); this.scoreval.Text = r.score.ToString(); this.streakval.Text = r.streak.ToString(); this.suicidesval.Text = r.suicides.ToString(); this.tiesval.Text = r.ties.ToString(); this.timepval.Text = TimeSpan.FromSeconds(r.time).ToString(); this.winsval.Text = r.wins.ToString(); this.xpval.Text = r.xp.ToString(); this.kdrval.Text = Math.Round(((double)r.kills / (double)(r.deaths == 0 ? 1 : r.deaths)), 2).ToString(); this.wlrval.Text = Math.Round((double)r.wins / (double)(r.losses == 0 ? 1 : r.losses), 2).ToString(); this.accuracyval.Text = (Math.Round(((double)r.hits / (double)(r.total_shots == 0 ? 1 : r.total_shots)), 2) * 100).ToString() + "%"; }
private void checkFriendStatsbtn_Click(object sender, EventArgs e) { FriendItem f = GetFriendItemFromIndex(friendView.SelectedItems[0].Index); StatsReader sr = f.GetStatistics(); if (sr == null) { MessageBox.Show("Could not download statistics for this player!", "Retrieval error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } new FriendStats(f.Name, sr).ShowDialog(); }