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