From f7ad2baa5214f2b588ca44b6ed72a50c3dd56466 Mon Sep 17 00:00:00 2001 From: AmazingDM Date: Tue, 5 Jan 2021 17:11:11 +0800 Subject: [PATCH] Optimized code --- Netch/Controllers/HTTPController.cs | 2 +- Netch/Forms/MainForm.Status.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Netch/Controllers/HTTPController.cs b/Netch/Controllers/HTTPController.cs index b5393993..b3fd005f 100644 --- a/Netch/Controllers/HTTPController.cs +++ b/Netch/Controllers/HTTPController.cs @@ -39,7 +39,7 @@ namespace Netch.Controllers if (mode.Type == 3) { - if ((MainController.Server.Type == "Socks5" || MainController.Server.Type == "Trojan") && mode.BypassChina) + if ((MainController.Server.Type is "Socks5" or "Trojan") && mode.BypassChina) { //启动PAC服务器 PACServerHandle.InitPACServer("127.0.0.1"); diff --git a/Netch/Forms/MainForm.Status.cs b/Netch/Forms/MainForm.Status.cs index ac0a8d7e..88e907e0 100644 --- a/Netch/Forms/MainForm.Status.cs +++ b/Netch/Forms/MainForm.Status.cs @@ -72,7 +72,7 @@ namespace Netch.Forms //Socks5 Boolean s5BwFlag = true; - if (MainController.Server.Type == "Socks5") + if (MainController.Server.Type is "Socks5") { Socks5 SocksServer = (Socks5) MainController.Server; @@ -80,7 +80,7 @@ namespace Netch.Forms } //Socks5无身份验证且为网页代理模式时无法统计流量不显示流量状态栏,Socks5有身份验证时将统计V2ray的流量 - if (s5BwFlag || (MainController.Mode.Type == 0 || MainController.Mode.Type == 1 || MainController.Mode.Type == 2)) + if (s5BwFlag || Models.ModeExtension.TestNatRequired(MainController.Mode)) UsedBandwidthLabel.Visible /*= UploadSpeedLabel.Visible*/ = DownloadSpeedLabel.Visible = Global.Flags.IsWindows10Upper; break; case State.Stopping: