public ConnectionQuality(bool succeeded, long elapsed) { this.Ping = elapsed; if (!succeeded) { this.Rank = ConnectionQualityRank.NA; return; } this.SetRank(); }
public ConnectionQuality(PingReply pingReply) { this.Ping = pingReply.RoundtripTime; if (pingReply.Status != IPStatus.Success) { this.Rank = ConnectionQualityRank.NA; return; } this.SetRank(); }
private void SetRank() { if (this.Ping < 50) { this.Rank = ConnectionQualityRank.VeryGood; } else if (this.Ping < 100) { this.Rank = ConnectionQualityRank.Good; } else if (this.Ping < 150) { this.Rank = ConnectionQualityRank.Normal; } else if (this.Ping < 200) { this.Rank = ConnectionQualityRank.Bad; } else if (this.Ping >= 200) { this.Rank = ConnectionQualityRank.VeryBad; } }
public ConnectionQuality() { this.Ping = 0; this.Rank = ConnectionQualityRank.NA; }