From 2bd4088d4074b68cc92debef4bf6c5cb1c14bb8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E4=BB=99=E5=A5=B3?= Date: Sun, 19 Feb 2023 19:15:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=3D=3D=E6=9B=BF=E4=BB=A3strin?= =?UTF-8?q?g.Equals?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- v2rayN/PacLib/PacHandler.cs | 6 +++--- v2rayN/v2rayN/Handler/CoreConfigHandler.cs | 14 +++++++------- v2rayN/v2rayN/Handler/TunHandler.cs | 2 +- v2rayN/v2rayN/Tool/Utils.cs | 4 ++-- v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs | 4 ++-- .../v2rayN/ViewModels/RoutingSettingViewModel.cs | 2 +- v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/v2rayN/PacLib/PacHandler.cs b/v2rayN/PacLib/PacHandler.cs index ee95d4e1..819a94a8 100644 --- a/v2rayN/PacLib/PacHandler.cs +++ b/v2rayN/PacLib/PacHandler.cs @@ -20,9 +20,9 @@ public class PacHandler public static void Start(string configPath, int httpPort, int pacPort) { - if (configPath.Equals(_configPath) - && httpPort.Equals(_httpPort) - && pacPort.Equals(_pacPort) + if (configPath == _configPath + && httpPort == _httpPort + && pacPort == _pacPort && _isRunning) { _needRestart = false; diff --git a/v2rayN/v2rayN/Handler/CoreConfigHandler.cs b/v2rayN/v2rayN/Handler/CoreConfigHandler.cs index b0d18e31..c5e345f0 100644 --- a/v2rayN/v2rayN/Handler/CoreConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/CoreConfigHandler.cs @@ -613,12 +613,12 @@ namespace v2rayN.Handler mtu = config.kcpItem.mtu, tti = config.kcpItem.tti }; - if (iobound.Equals("out")) + if (iobound == "out") { kcpSettings.uplinkCapacity = config.kcpItem.uplinkCapacity; kcpSettings.downlinkCapacity = config.kcpItem.downlinkCapacity; } - else if (iobound.Equals("in")) + else if (iobound == "in") { kcpSettings.uplinkCapacity = config.kcpItem.downlinkCapacity; ; kcpSettings.downlinkCapacity = config.kcpItem.downlinkCapacity; @@ -724,7 +724,7 @@ namespace v2rayN.Handler break; default: //tcp - if (node.headerType.Equals(Global.TcpHeaderHttp)) + if (node.headerType == Global.TcpHeaderHttp) { TcpSettings tcpSettings = new() { @@ -734,7 +734,7 @@ namespace v2rayN.Handler } }; - if (iobound.Equals("out")) + if (iobound == "out") { //request Host string request = Utils.GetEmbedText(Global.v2raySampleHttprequestFileName); @@ -753,7 +753,7 @@ namespace v2rayN.Handler request = request.Replace("$requestPath$", $"\"{pathHttp}\""); tcpSettings.header.request = Utils.FromJson(request); } - else if (iobound.Equals("in")) + else if (iobound == "in") { //string response = Utils.GetEmbedText(Global.v2raySampleHttpresponseFileName); //tcpSettings.header.response = Utils.FromJson(response); @@ -1184,7 +1184,7 @@ namespace v2rayN.Handler && outbound.streamSettings.tcpSettings.header != null && !Utils.IsNullOrEmpty(outbound.streamSettings.tcpSettings.header.type)) { - if (outbound.streamSettings.tcpSettings.header.type.Equals(Global.TcpHeaderHttp)) + if (outbound.streamSettings.tcpSettings.header.type == Global.TcpHeaderHttp) { profileItem.headerType = outbound.streamSettings.tcpSettings.header.type; string request = Convert.ToString(outbound.streamSettings.tcpSettings.header.request); @@ -1322,7 +1322,7 @@ namespace v2rayN.Handler && inbound.streamSettings.tcpSettings.header != null && !Utils.IsNullOrEmpty(inbound.streamSettings.tcpSettings.header.type)) { - if (inbound.streamSettings.tcpSettings.header.type.Equals(Global.TcpHeaderHttp)) + if (inbound.streamSettings.tcpSettings.header.type == Global.TcpHeaderHttp) { profileItem.headerType = inbound.streamSettings.tcpSettings.header.type; string request = Convert.ToString(inbound.streamSettings.tcpSettings.header.request); diff --git a/v2rayN/v2rayN/Handler/TunHandler.cs b/v2rayN/v2rayN/Handler/TunHandler.cs index c0a1de04..0ce373c6 100644 --- a/v2rayN/v2rayN/Handler/TunHandler.cs +++ b/v2rayN/v2rayN/Handler/TunHandler.cs @@ -45,7 +45,7 @@ namespace v2rayN.Base { var socksPort = LazyConfig.Instance.GetLocalPort(Global.InboundSocks); - if (socksPort.Equals(_socksPort) + if (socksPort == _socksPort && _process != null && !_process.HasExited) { diff --git a/v2rayN/v2rayN/Tool/Utils.cs b/v2rayN/v2rayN/Tool/Utils.cs index 6f4e5e69..4cc1b7c1 100644 --- a/v2rayN/v2rayN/Tool/Utils.cs +++ b/v2rayN/v2rayN/Tool/Utils.cs @@ -489,7 +489,7 @@ namespace v2rayN { return true; } - if (text.Equals("null")) + if (text == "null") { return true; } @@ -636,7 +636,7 @@ namespace v2rayN string value = RegReadValue(Global.AutoRunRegPath, Global.AutoRunName, ""); string exePath = GetExePath(); - if (value?.Equals(exePath) == true || value?.Equals($"\"{exePath}\"") == true) + if (value == exePath || value == $"\"{exePath}\"") { return true; } diff --git a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs index 79be3452..adf4d067 100644 --- a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs @@ -788,7 +788,7 @@ namespace v2rayN.ViewModels var item = new ComboItem() { ID = it.indexId, Text = name }; _servers.Add(item); - if (_config.indexId.Equals(it.indexId)) + if (_config.indexId == it.indexId) { SelectedServer = item; } @@ -1456,7 +1456,7 @@ namespace v2rayN.ViewModels foreach (var item in routings) { _routingItems.Add(item); - if (item.id.Equals(_config.routingBasicItem.routingIndexId)) + if (item.id == _config.routingBasicItem.routingIndexId) { SelectedRouting = item; } diff --git a/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs index 39dd1fbf..01b27ff2 100644 --- a/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs @@ -163,7 +163,7 @@ namespace v2rayN.ViewModels foreach (var item in routings) { bool def = false; - if (item.id.Equals(_config.routingBasicItem.routingIndexId)) + if (item.id == _config.routingBasicItem.routingIndexId) { def = true; } diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs index c891cd2a..71141622 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs @@ -77,7 +77,7 @@ namespace v2rayN.Views try { var files = Directory.GetFiles(Utils.GetFontsPath(), "*.ttf"); - var culture = _config.uiItem.currentLanguage.Equals(Global.Languages[0]) ? "zh-cn" : "en-us"; + var culture = _config.uiItem.currentLanguage == Global.Languages[0] ? "zh-cn" : "en-us"; var culture2 = "en-us"; foreach (var ttf in files) {