使用==替代string.Equals

pull/3315/head
小仙女 2 years ago
parent ee61363c31
commit 2bd4088d40

@ -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;

@ -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<object>(request);
}
else if (iobound.Equals("in"))
else if (iobound == "in")
{
//string response = Utils.GetEmbedText(Global.v2raySampleHttpresponseFileName);
//tcpSettings.header.response = Utils.FromJson<object>(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);

@ -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)
{

@ -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;
}

@ -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;
}

@ -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;
}

@ -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)
{

Loading…
Cancel
Save