Ping tab: add current connection (#29)
This commit is contained in:
parent
1de7b3e430
commit
662bd5694f
6 changed files with 72 additions and 2 deletions
|
@ -98,6 +98,7 @@ LANG=日本語
|
|||
340=テスト&& お知らせ保存
|
||||
341=TTS使用
|
||||
342=正しいDiscordのウェブフックURLを入力してください
|
||||
343=現在アドレス
|
||||
|
||||
10001="{0}" 発生!
|
||||
10002=待機: {0}
|
||||
|
|
|
@ -98,6 +98,7 @@ LANG=한국어(액토즈)
|
|||
340=테스트 && 알림설정 저장
|
||||
341=말하기 사용
|
||||
342=올바른 디스코드 웹훅 주소를 입력해주세요.
|
||||
343=연결된 IP주소
|
||||
|
||||
10001="{0}" 발생했어요!
|
||||
10002=찾습니다: {0}
|
||||
|
|
|
@ -98,6 +98,7 @@ LANG=한국어
|
|||
340=테스트 && 알림설정 저장
|
||||
341=TTS 사용
|
||||
342=올바른 디스코드 Webhook을 입력해주세요.
|
||||
343=현재 연결 IP
|
||||
|
||||
10001="{0}" 떠스요!
|
||||
10002=찾아요: {0}
|
||||
|
|
|
@ -99,6 +99,7 @@ LANG=English
|
|||
340=Test && Save Notifies
|
||||
341=Use TTS
|
||||
342=Invalid discord webhook URL
|
||||
343=Address
|
||||
|
||||
10001="{0}" spawned!
|
||||
10002=Entry: {0}
|
||||
|
|
30
Tab/PingForm.Designer.cs
generated
30
Tab/PingForm.Designer.cs
generated
|
@ -46,6 +46,8 @@ namespace DutyContent.Tab
|
|||
this.lblPingColors = new System.Windows.Forms.Label();
|
||||
this.chkUsePing = new System.Windows.Forms.CheckBox();
|
||||
this.panelDock = new System.Windows.Forms.Panel();
|
||||
this.lblPingAddress = new System.Windows.Forms.Label();
|
||||
this.lstPingAddress = new System.Windows.Forms.ListBox();
|
||||
this.panel6.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbxPingGraph)).BeginInit();
|
||||
this.tlpnPingColors.SuspendLayout();
|
||||
|
@ -58,6 +60,8 @@ namespace DutyContent.Tab
|
|||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panel6.AutoScroll = true;
|
||||
this.panel6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.panel6.Controls.Add(this.lstPingAddress);
|
||||
this.panel6.Controls.Add(this.lblPingAddress);
|
||||
this.panel6.Controls.Add(this.cboPingDefAddr);
|
||||
this.panel6.Controls.Add(this.lblPingDefAddr);
|
||||
this.panel6.Controls.Add(this.pbxPingGraph);
|
||||
|
@ -67,7 +71,7 @@ namespace DutyContent.Tab
|
|||
this.panel6.Controls.Add(this.chkUsePing);
|
||||
this.panel6.Location = new System.Drawing.Point(12, 12);
|
||||
this.panel6.Name = "panel6";
|
||||
this.panel6.Size = new System.Drawing.Size(776, 304);
|
||||
this.panel6.Size = new System.Drawing.Size(776, 399);
|
||||
this.panel6.TabIndex = 2;
|
||||
//
|
||||
// cboPingDefAddr
|
||||
|
@ -256,6 +260,28 @@ namespace DutyContent.Tab
|
|||
this.panelDock.Size = new System.Drawing.Size(800, 450);
|
||||
this.panelDock.TabIndex = 3;
|
||||
//
|
||||
// lblPingAddress
|
||||
//
|
||||
this.lblPingAddress.AutoSize = true;
|
||||
this.lblPingAddress.Location = new System.Drawing.Point(23, 315);
|
||||
this.lblPingAddress.Name = "lblPingAddress";
|
||||
this.lblPingAddress.Size = new System.Drawing.Size(25, 13);
|
||||
this.lblPingAddress.TabIndex = 16;
|
||||
this.lblPingAddress.Text = "343";
|
||||
//
|
||||
// lstPingAddress
|
||||
//
|
||||
this.lstPingAddress.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lstPingAddress.FormattingEnabled = true;
|
||||
this.lstPingAddress.Location = new System.Drawing.Point(129, 309);
|
||||
this.lstPingAddress.Name = "lstPingAddress";
|
||||
this.lstPingAddress.ScrollAlwaysVisible = true;
|
||||
this.lstPingAddress.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
|
||||
this.lstPingAddress.Size = new System.Drawing.Size(642, 82);
|
||||
this.lstPingAddress.TabIndex = 17;
|
||||
//
|
||||
// PingForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -294,5 +320,7 @@ namespace DutyContent.Tab
|
|||
private System.Windows.Forms.Label lblPingColors;
|
||||
private System.Windows.Forms.CheckBox chkUsePing;
|
||||
private System.Windows.Forms.Panel panelDock;
|
||||
private System.Windows.Forms.Label lblPingAddress;
|
||||
private System.Windows.Forms.ListBox lstPingAddress;
|
||||
}
|
||||
}
|
|
@ -90,7 +90,7 @@ namespace DutyContent.Tab
|
|||
|
||||
public void RefreshLocale()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void UpdateUiLocale()
|
||||
|
@ -103,6 +103,7 @@ namespace DutyContent.Tab
|
|||
lblPingStat4.Text = MesgLog.Text(333);
|
||||
chkPingGraph.Text = MesgLog.Text(334);
|
||||
lblPingDefAddr.Text = MesgLog.Text(335);
|
||||
lblPingAddress.Text = MesgLog.Text(343);
|
||||
}
|
||||
|
||||
private void SaveConfig(int interval = 5000)
|
||||
|
@ -220,10 +221,14 @@ namespace DutyContent.Tab
|
|||
long rtt = 0;
|
||||
double loss = 0;
|
||||
|
||||
List<string> addrs = new List<string>();
|
||||
|
||||
if (conns.Length > 0)
|
||||
{
|
||||
foreach (var row in conns)
|
||||
{
|
||||
addrs.Add(row.RemoteAddress.ToString());
|
||||
|
||||
var (r, l) = CalcPing(row.RemoteAddress);
|
||||
|
||||
if (rtt < r)
|
||||
|
@ -241,6 +246,8 @@ namespace DutyContent.Tab
|
|||
return;
|
||||
}
|
||||
|
||||
addrs.Add(DcConfig.Duty.PingDefAddr);
|
||||
|
||||
var defip = ThirdParty.Converter.ToIPAddressFromIPV4(DcConfig.Duty.PingDefAddr);
|
||||
|
||||
if (defip == IPAddress.None || defip == IPAddress.IPv6None)
|
||||
|
@ -289,6 +296,37 @@ namespace DutyContent.Tab
|
|||
_grpr.DrawValues(_kepts);
|
||||
WorkerAct.Invoker(() => _grpr.Leave());
|
||||
}
|
||||
|
||||
//
|
||||
if (addrs.Count == 0)
|
||||
{
|
||||
if (lstPingAddress.Items.Count != 0)
|
||||
lstPingAddress.Items.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
bool havetoupdate = false;
|
||||
|
||||
if (lstPingAddress.Items.Count == 0)
|
||||
havetoupdate = true;
|
||||
else
|
||||
{
|
||||
var i = lstPingAddress.Items[0] as string;
|
||||
havetoupdate = !addrs.Contains(i);
|
||||
}
|
||||
|
||||
if (havetoupdate)
|
||||
{
|
||||
WorkerAct.Invoker(() =>
|
||||
{
|
||||
lstPingAddress.BeginUpdate();
|
||||
lstPingAddress.Items.Clear();
|
||||
foreach (var i in addrs)
|
||||
lstPingAddress.Items.Add(i);
|
||||
lstPingAddress.EndUpdate();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// http://forum.codecall.net/topic/37643-c-packet-lossping-program/
|
||||
|
|
Loading…
Reference in a new issue