コード例 #1
0
        public ConnectionQuality(bool succeeded, long elapsed)
        {
            this.Ping = elapsed;

            if (!succeeded)
            {
                this.Rank = ConnectionQualityRank.NA;
                return;
            }

            this.SetRank();
        }
コード例 #2
0
        public ConnectionQuality(PingReply pingReply)
        {
            this.Ping = pingReply.RoundtripTime;

            if (pingReply.Status != IPStatus.Success)
            {
                this.Rank = ConnectionQualityRank.NA;
                return;
            }

            this.SetRank();
        }
コード例 #3
0
 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;
     }
 }
コード例 #4
0
 public ConnectionQuality()
 {
     this.Ping = 0;
     this.Rank = ConnectionQualityRank.NA;
 }