From 6f1025c73e0bb09157dff97114433078a057c112 Mon Sep 17 00:00:00 2001 From: AmazingDM Date: Tue, 11 Aug 2020 17:39:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0NTT=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=B8=BA=E6=95=B0=E5=AD=97=E6=98=BE=E7=A4=BA=201.FullCone=202.?= =?UTF-8?q?RestrictedCone=203.PortRestrictedCone=204.Symmetric?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Netch/Forms/MainForm.Status.cs | 39 ++++++++++++++++++++++++++++++---- Netch/Models/Setting.cs | 2 +- binaries | 2 +- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/Netch/Forms/MainForm.Status.cs b/Netch/Forms/MainForm.Status.cs index 7aadcc34..86209e2e 100644 --- a/Netch/Forms/MainForm.Status.cs +++ b/Netch/Forms/MainForm.Status.cs @@ -124,11 +124,13 @@ namespace Netch.Forms { NatTypeStatusLabel.Text = String.Format("NAT{0}{1}", i18N.Translate(": "), text); } - - if (Enum.TryParse(text, false, out STUN_Client.NatType natType)) + if (int.TryParse(text, out int natType)) { - NatTypeStatusLightLabel.Visible = true; - UpdateNatTypeLight(natType); + if (natType > 0 && natType < 5) + { + NatTypeStatusLightLabel.Visible = true; + UpdateNatTypeLight(natType); + } } } else @@ -169,6 +171,35 @@ namespace Netch.Forms NatTypeStatusLightLabel.ForeColor = c; } + /// + /// 更新 NAT指示灯颜色 + /// + /// + private void UpdateNatTypeLight(int natType) + { + Color c; + switch (natType) + { + case 1: + c = Color.LimeGreen; + break; + case 2: + c = Color.Yellow; + break; + case 3: + c = Color.Red; + break; + case 4: + c = Color.Black; + break; + default: + c = Color.Black; + break; + } + + NatTypeStatusLightLabel.ForeColor = c; + } + /// /// 更新状态栏文本 /// diff --git a/Netch/Models/Setting.cs b/Netch/Models/Setting.cs index d9973a78..c2320f41 100644 --- a/Netch/Models/Setting.cs +++ b/Netch/Models/Setting.cs @@ -166,7 +166,7 @@ namespace Netch.Models /// /// STUN测试服务器 /// - public string STUN_Server = "stun.stunprotocol.org"; + public string STUN_Server = "stun.syncthing.net"; /// /// STUN测试服务器 diff --git a/binaries b/binaries index 5973ce45..8ba24379 160000 --- a/binaries +++ b/binaries @@ -1 +1 @@ -Subproject commit 5973ce45edfdcd468dba9262eb69759cd96e6c94 +Subproject commit 8ba243799b54f133e4d244ef79759b66cb4f9bb7