Replace all Utils.IsNullOrEmpty(variable) with variable.IsNullOrEmpty()

This commit is contained in:
2dust 2025-03-05 19:44:49 +08:00
parent f3af831cf2
commit 71cc6d7a88
34 changed files with 153 additions and 162 deletions

View file

@ -10,7 +10,7 @@ namespace ServiceLib.Common
public async Task<string?> DownloadStringAsync(IWebProxy? webProxy, string url, string? userAgent, int timeout)
{
if (Utils.IsNullOrEmpty(url))
if (url.IsNullOrEmpty())
{
return null;
}
@ -56,7 +56,7 @@ namespace ServiceLib.Common
public async Task DownloadDataAsync4Speed(IWebProxy webProxy, string url, IProgress<string> progress, int timeout)
{
if (Utils.IsNullOrEmpty(url))
if (url.IsNullOrEmpty())
{
throw new ArgumentNullException(nameof(url));
}
@ -119,11 +119,11 @@ namespace ServiceLib.Common
public async Task DownloadFileAsync(IWebProxy? webProxy, string url, string fileName, IProgress<double> progress, int timeout)
{
if (Utils.IsNullOrEmpty(url))
if (url.IsNullOrEmpty())
{
throw new ArgumentNullException(nameof(url));
}
if (Utils.IsNullOrEmpty(fileName))
if (fileName.IsNullOrEmpty())
{
throw new ArgumentNullException(nameof(fileName));
}

View file

@ -22,7 +22,7 @@ namespace ServiceLib.Common
public async Task<string?> TryGetAsync(string url)
{
if (Utils.IsNullOrEmpty(url))
if (url.IsNullOrEmpty())
return null;
try
@ -38,14 +38,14 @@ namespace ServiceLib.Common
public async Task<string?> GetAsync(string url)
{
if (Utils.IsNullOrEmpty(url))
if (url.IsNullOrEmpty())
return null;
return await httpClient.GetStringAsync(url);
}
public async Task<string?> GetAsync(HttpClient client, string url, CancellationToken token = default)
{
if (Utils.IsNullOrEmpty(url))
if (url.IsNullOrEmpty())
return null;
return await client.GetStringAsync(url, token);
}
@ -123,7 +123,7 @@ namespace ServiceLib.Common
public async Task DownloadDataAsync4Speed(HttpClient client, string url, IProgress<string> progress, CancellationToken token = default)
{
if (Utils.IsNullOrEmpty(url))
if (url.IsNullOrEmpty())
{
throw new ArgumentNullException(nameof(url));
}

View file

@ -252,7 +252,7 @@ namespace ServiceLib.Common
public static NameValueCollection ParseQueryString(string query)
{
var result = new NameValueCollection(StringComparer.OrdinalIgnoreCase);
if (IsNullOrEmpty(query))
if (query.IsNullOrEmpty())
{
return result;
}
@ -298,7 +298,7 @@ namespace ServiceLib.Common
/// <returns></returns>
public static string GetPunycode(string url)
{
if (Utils.IsNullOrEmpty(url))
if (url.IsNullOrEmpty())
{
return url;
}
@ -331,7 +331,7 @@ namespace ServiceLib.Common
public static string Convert2Comma(string text)
{
if (IsNullOrEmpty(text))
if (text.IsNullOrEmpty())
{
return text;
}
@ -353,15 +353,6 @@ namespace ServiceLib.Common
return oText.All(char.IsNumber);
}
public static bool IsNullOrEmpty(string? text)
{
if (string.IsNullOrWhiteSpace(text))
{
return true;
}
return text == "null";
}
/// <summary>
/// 验证Domain地址是否合法
@ -369,7 +360,7 @@ namespace ServiceLib.Common
/// <param name="domain"></param>
public static bool IsDomain(string? domain)
{
if (IsNullOrEmpty(domain))
if (domain.IsNullOrEmpty())
{
return false;
}
@ -655,7 +646,7 @@ namespace ServiceLib.Common
public static string GetPath(string fileName)
{
var startupPath = StartupPath();
if (IsNullOrEmpty(fileName))
if (fileName.IsNullOrEmpty())
{
return startupPath;
}
@ -691,7 +682,7 @@ namespace ServiceLib.Common
Directory.CreateDirectory(tempPath);
}
if (IsNullOrEmpty(filename))
if (filename.IsNullOrEmpty())
{
return tempPath;
}
@ -720,7 +711,7 @@ namespace ServiceLib.Common
Directory.CreateDirectory(tempPath);
}
if (Utils.IsNullOrEmpty(filename))
if (filename.IsNullOrEmpty())
{
return tempPath;
}
@ -747,7 +738,7 @@ namespace ServiceLib.Common
}
}
if (IsNullOrEmpty(filename))
if (filename.IsNullOrEmpty())
{
return tempPath;
}
@ -765,7 +756,7 @@ namespace ServiceLib.Common
Directory.CreateDirectory(tempPath);
}
if (Utils.IsNullOrEmpty(filename))
if (filename.IsNullOrEmpty())
{
return tempPath;
}
@ -783,7 +774,7 @@ namespace ServiceLib.Common
Directory.CreateDirectory(tempPath);
}
if (Utils.IsNullOrEmpty(filename))
if (filename.IsNullOrEmpty())
{
return tempPath;
}
@ -801,7 +792,7 @@ namespace ServiceLib.Common
Directory.CreateDirectory(tempPath);
}
if (Utils.IsNullOrEmpty(filename))
if (filename.IsNullOrEmpty())
{
return tempPath;
}

View file

@ -15,7 +15,7 @@ namespace ServiceLib.Common
{
regKey = Registry.CurrentUser.OpenSubKey(path, false);
var value = regKey?.GetValue(name) as string;
return Utils.IsNullOrEmpty(value) ? def : value;
return value.IsNullOrEmpty() ? def : value;
}
catch (Exception ex)
{
@ -34,7 +34,7 @@ namespace ServiceLib.Common
try
{
regKey = Registry.CurrentUser.CreateSubKey(path);
if (Utils.IsNullOrEmpty(value.ToString()))
if (value.ToString().IsNullOrEmpty())
{
regKey?.DeleteValue(name, false);
}

View file

@ -131,7 +131,7 @@ namespace ServiceLib.Handler
public async Task<List<ProfileItem>?> ProfileItems(string subid)
{
if (Utils.IsNullOrEmpty(subid))
if (subid.IsNullOrEmpty())
{
return await SQLiteHelper.Instance.TableAsync<ProfileItem>().ToListAsync();
}
@ -171,7 +171,7 @@ namespace ServiceLib.Handler
public async Task<ProfileItem?> GetProfileItem(string indexId)
{
if (Utils.IsNullOrEmpty(indexId))
if (indexId.IsNullOrEmpty())
{
return null;
}
@ -180,7 +180,7 @@ namespace ServiceLib.Handler
public async Task<ProfileItem?> GetProfileItemViaRemarks(string? remarks)
{
if (Utils.IsNullOrEmpty(remarks))
if (remarks.IsNullOrEmpty())
{
return null;
}

View file

@ -85,7 +85,7 @@ namespace ServiceLib.Handler
/// <exception cref="ArgumentNullException"></exception>
public static void AutoStartTaskService(string taskName, string fileName, string description)
{
if (Utils.IsNullOrEmpty(taskName))
if (taskName.IsNullOrEmpty())
{
return;
}
@ -93,7 +93,7 @@ namespace ServiceLib.Handler
var logonUser = WindowsIdentity.GetCurrent().Name;
using var taskService = new Microsoft.Win32.TaskScheduler.TaskService();
var tasks = taskService.RootFolder.GetTasks(new Regex(taskName));
if (Utils.IsNullOrEmpty(fileName))
if (fileName.IsNullOrEmpty())
{
foreach (var t in tasks)
{

View file

@ -67,7 +67,7 @@ namespace ServiceLib.Handler
}
config.RoutingBasicItem ??= new();
if (Utils.IsNullOrEmpty(config.RoutingBasicItem.DomainStrategy))
if (config.RoutingBasicItem.DomainStrategy.IsNullOrEmpty())
{
config.RoutingBasicItem.DomainStrategy = Global.DomainStrategies.First();
}
@ -103,7 +103,7 @@ namespace ServiceLib.Handler
};
config.UiItem.MainColumnItem ??= new();
if (Utils.IsNullOrEmpty(config.UiItem.CurrentLanguage))
if (config.UiItem.CurrentLanguage.IsNullOrEmpty())
{
config.UiItem.CurrentLanguage = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.Equals("zh", StringComparison.CurrentCultureIgnoreCase)
? Global.Languages.First()
@ -117,11 +117,11 @@ namespace ServiceLib.Handler
{
config.SpeedTestItem.SpeedTestTimeout = 10;
}
if (Utils.IsNullOrEmpty(config.SpeedTestItem.SpeedTestUrl))
if (config.SpeedTestItem.SpeedTestUrl.IsNullOrEmpty())
{
config.SpeedTestItem.SpeedTestUrl = Global.SpeedTestUrls.First();
}
if (Utils.IsNullOrEmpty(config.SpeedTestItem.SpeedPingTestUrl))
if (config.SpeedTestItem.SpeedPingTestUrl.IsNullOrEmpty())
{
config.SpeedTestItem.SpeedPingTestUrl = Global.SpeedPingTestUrl;
}
@ -354,7 +354,7 @@ namespace ServiceLib.Handler
/// <returns></returns>
public static async Task<int> SetDefaultServerIndex(Config config, string? indexId)
{
if (Utils.IsNullOrEmpty(indexId))
if (indexId.IsNullOrEmpty())
{
return -1;
}
@ -506,7 +506,7 @@ namespace ServiceLib.Handler
profileItem.Address = newFileName;
profileItem.ConfigType = EConfigType.Custom;
if (Utils.IsNullOrEmpty(profileItem.Remarks))
if (profileItem.Remarks.IsNullOrEmpty())
{
profileItem.Remarks = $"import custom@{DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")}";
}
@ -624,7 +624,7 @@ namespace ServiceLib.Handler
profileItem.Address = profileItem.Address.TrimEx();
profileItem.Id = profileItem.Id.TrimEx();
if (Utils.IsNullOrEmpty(profileItem.StreamSecurity))
if (profileItem.StreamSecurity.IsNullOrEmpty())
{
profileItem.StreamSecurity = Global.StreamSecurity;
}
@ -654,7 +654,7 @@ namespace ServiceLib.Handler
profileItem.Path = profileItem.Path.TrimEx();
profileItem.Network = string.Empty;
if (Utils.IsNullOrEmpty(profileItem.StreamSecurity))
if (profileItem.StreamSecurity.IsNullOrEmpty())
{
profileItem.StreamSecurity = Global.StreamSecurity;
}
@ -689,11 +689,11 @@ namespace ServiceLib.Handler
profileItem.HeaderType = Global.TuicCongestionControls.FirstOrDefault()!;
}
if (Utils.IsNullOrEmpty(profileItem.StreamSecurity))
if (profileItem.StreamSecurity.IsNullOrEmpty())
{
profileItem.StreamSecurity = Global.StreamSecurity;
}
if (Utils.IsNullOrEmpty(profileItem.Alpn))
if (profileItem.Alpn.IsNullOrEmpty())
{
profileItem.Alpn = "h3";
}
@ -906,11 +906,11 @@ namespace ServiceLib.Handler
}
else
{
if (Utils.IsNullOrEmpty(profileItem.AllowInsecure))
if (profileItem.AllowInsecure.IsNullOrEmpty())
{
profileItem.AllowInsecure = config.CoreBasicItem.DefAllowInsecure.ToString().ToLower();
}
if (Utils.IsNullOrEmpty(profileItem.Fingerprint) && profileItem.StreamSecurity == Global.StreamSecurityReality)
if (profileItem.Fingerprint.IsNullOrEmpty() && profileItem.StreamSecurity == Global.StreamSecurityReality)
{
profileItem.Fingerprint = config.CoreBasicItem.DefFingerprint;
}
@ -923,7 +923,7 @@ namespace ServiceLib.Handler
}
var maxSort = -1;
if (Utils.IsNullOrEmpty(profileItem.IndexId))
if (profileItem.IndexId.IsNullOrEmpty())
{
profileItem.IndexId = Utils.GetGuid(false);
maxSort = ProfileExHandler.Instance.GetMaxSort();
@ -1084,7 +1084,7 @@ namespace ServiceLib.Handler
/// <returns>成功导入的数量</returns>
private static async Task<int> AddBatchServersCommon(Config config, string strData, string subid, bool isSub)
{
if (Utils.IsNullOrEmpty(strData))
if (strData.IsNullOrEmpty())
{
return -1;
}
@ -1163,7 +1163,7 @@ namespace ServiceLib.Handler
private static async Task<int> AddBatchServers4Custom(Config config, string strData, string subid, bool isSub)
{
if (Utils.IsNullOrEmpty(strData))
if (strData.IsNullOrEmpty())
{
return -1;
}
@ -1236,7 +1236,7 @@ namespace ServiceLib.Handler
{
profileItem = NaiveproxyFmt.ResolveFull(strData, subRemarks);
}
if (profileItem is null || Utils.IsNullOrEmpty(profileItem.Address))
if (profileItem is null || profileItem.Address.IsNullOrEmpty())
{
return -1;
}
@ -1261,7 +1261,7 @@ namespace ServiceLib.Handler
private static async Task<int> AddBatchServers4SsSIP008(Config config, string strData, string subid, bool isSub)
{
if (Utils.IsNullOrEmpty(strData))
if (strData.IsNullOrEmpty())
{
return -1;
}
@ -1293,7 +1293,7 @@ namespace ServiceLib.Handler
public static async Task<int> AddBatchServers(Config config, string strData, string subid, bool isSub)
{
if (Utils.IsNullOrEmpty(strData))
if (strData.IsNullOrEmpty())
{
return -1;
}
@ -1424,7 +1424,7 @@ namespace ServiceLib.Handler
item.Memo = subItem.Memo;
}
if (Utils.IsNullOrEmpty(item.Id))
if (item.Id.IsNullOrEmpty())
{
item.Id = Utils.GetGuid(false);
@ -1457,7 +1457,7 @@ namespace ServiceLib.Handler
/// <returns></returns>
public static async Task<int> RemoveServersViaSubid(Config config, string subid, bool isSub)
{
if (Utils.IsNullOrEmpty(subid))
if (subid.IsNullOrEmpty())
{
return -1;
}
@ -1508,7 +1508,7 @@ namespace ServiceLib.Handler
public static async Task<int> SaveRoutingItem(Config config, RoutingItem item)
{
if (Utils.IsNullOrEmpty(item.Id))
if (item.Id.IsNullOrEmpty())
{
item.Id = Utils.GetGuid(false);
}
@ -1531,7 +1531,7 @@ namespace ServiceLib.Handler
/// <returns></returns>
public static async Task<int> AddBatchRoutingRules(RoutingItem routingItem, string strData)
{
if (Utils.IsNullOrEmpty(strData))
if (strData.IsNullOrEmpty())
{
return -1;
}
@ -1549,7 +1549,7 @@ namespace ServiceLib.Handler
routingItem.RuleNum = lstRules.Count;
routingItem.RuleSet = JsonUtils.Serialize(lstRules, false);
if (Utils.IsNullOrEmpty(routingItem.Id))
if (routingItem.Id.IsNullOrEmpty())
{
routingItem.Id = Utils.GetGuid(false);
}
@ -1820,7 +1820,7 @@ namespace ServiceLib.Handler
return -1;
}
if (Utils.IsNullOrEmpty(item.Id))
if (item.Id.IsNullOrEmpty())
{
item.Id = Utils.GetGuid(false);
}

View file

@ -240,7 +240,7 @@ namespace ServiceLib.Handler
private async Task<Process?> RunProcess(CoreInfo? coreInfo, string configPath, bool displayLog, bool mayNeedSudo)
{
var fileName = CoreInfoHandler.Instance.GetCoreExecFile(coreInfo, out var msg);
if (Utils.IsNullOrEmpty(fileName))
if (fileName.IsNullOrEmpty())
{
UpdateFunc(false, msg);
return null;
@ -274,13 +274,13 @@ namespace ServiceLib.Handler
{
proc.OutputDataReceived += (sender, e) =>
{
if (Utils.IsNullOrEmpty(e.Data))
if (e.Data.IsNullOrEmpty())
return;
UpdateFunc(false, e.Data + Environment.NewLine);
};
proc.ErrorDataReceived += (sender, e) =>
{
if (Utils.IsNullOrEmpty(e.Data))
if (e.Data.IsNullOrEmpty())
return;
UpdateFunc(false, e.Data + Environment.NewLine);
};

View file

@ -37,7 +37,7 @@
try
{
string str = config.TrimEx();
if (Utils.IsNullOrEmpty(str))
if (str.IsNullOrEmpty())
{
msg = ResUI.FailedReadConfiguration;
return null;

View file

@ -75,7 +75,7 @@
}
strProxy = string.Empty;
if (Utils.IsNullOrEmpty(config.SystemProxyItem.SystemProxyAdvancedProtocol))
if (config.SystemProxyItem.SystemProxyAdvancedProtocol.IsNullOrEmpty())
{
strProxy = $"{Global.Loopback}:{port}";
}

View file

@ -48,12 +48,12 @@ namespace ServiceLib.Models
public List<string>? GetAlpn()
{
return Utils.IsNullOrEmpty(Alpn) ? null : Utils.String2List(Alpn);
return Alpn.IsNullOrEmpty() ? null : Utils.String2List(Alpn);
}
public string GetNetwork()
{
if (Utils.IsNullOrEmpty(Network) || !Global.Networks.Contains(Network))
if (Network.IsNullOrEmpty() || !Global.Networks.Contains(Network))
{
return Global.DefaultNetwork;
}

View file

@ -45,7 +45,7 @@ namespace ServiceLib.Services.CoreConfig
}
string addressFileName = node.Address;
if (Utils.IsNullOrEmpty(addressFileName))
if (addressFileName.IsNullOrEmpty())
{
ret.Msg = ResUI.FailedGetDefaultConfiguration;
return ret;

View file

@ -36,7 +36,7 @@ namespace ServiceLib.Services.CoreConfig
ret.Msg = ResUI.InitialConfiguration;
string result = EmbedUtils.GetEmbedText(Global.SingboxSampleClient);
if (Utils.IsNullOrEmpty(result))
if (result.IsNullOrEmpty())
{
ret.Msg = ResUI.FailedGetDefaultConfiguration;
return ret;
@ -93,7 +93,7 @@ namespace ServiceLib.Services.CoreConfig
var result = EmbedUtils.GetEmbedText(Global.SingboxSampleClient);
var txtOutbound = EmbedUtils.GetEmbedText(Global.SingboxSampleOutbound);
if (Utils.IsNullOrEmpty(result) || txtOutbound.IsNullOrEmpty())
if (result.IsNullOrEmpty() || txtOutbound.IsNullOrEmpty())
{
ret.Msg = ResUI.FailedGetDefaultConfiguration;
return ret;
@ -138,7 +138,7 @@ namespace ServiceLib.Services.CoreConfig
var item = await AppHandler.Instance.GetProfileItem(it.IndexId);
if (it.ConfigType is EConfigType.VMess or EConfigType.VLESS)
{
if (item is null || Utils.IsNullOrEmpty(item.Id) || !Utils.IsGuidByParse(item.Id))
if (item is null || item.Id.IsNullOrEmpty() || !Utils.IsGuidByParse(item.Id))
{
continue;
}
@ -261,7 +261,7 @@ namespace ServiceLib.Services.CoreConfig
ret.Msg = ResUI.InitialConfiguration;
var result = EmbedUtils.GetEmbedText(Global.SingboxSampleClient);
if (Utils.IsNullOrEmpty(result))
if (result.IsNullOrEmpty())
{
ret.Msg = ResUI.FailedGetDefaultConfiguration;
return ret;
@ -317,7 +317,7 @@ namespace ServiceLib.Services.CoreConfig
string result = EmbedUtils.GetEmbedText(Global.SingboxSampleClient);
string txtOutbound = EmbedUtils.GetEmbedText(Global.SingboxSampleOutbound);
if (Utils.IsNullOrEmpty(result) || txtOutbound.IsNullOrEmpty())
if (result.IsNullOrEmpty() || txtOutbound.IsNullOrEmpty())
{
ret.Msg = ResUI.FailedGetDefaultConfiguration;
return ret;
@ -354,7 +354,7 @@ namespace ServiceLib.Services.CoreConfig
}
if (it.ConfigType is EConfigType.VMess or EConfigType.VLESS)
{
if (Utils.IsNullOrEmpty(item.Id) || !Utils.IsGuidByParse(item.Id))
if (item.Id.IsNullOrEmpty() || !Utils.IsGuidByParse(item.Id))
{
continue;
}
@ -443,7 +443,7 @@ namespace ServiceLib.Services.CoreConfig
}
string addressFileName = node.Address;
if (Utils.IsNullOrEmpty(addressFileName))
if (addressFileName.IsNullOrEmpty())
{
ret.Msg = ResUI.FailedGetDefaultConfiguration;
return ret;
@ -560,7 +560,7 @@ namespace ServiceLib.Services.CoreConfig
inbound.listen_port = AppHandler.Instance.GetLocalPort(EInboundProtocol.socks);
inbound.sniff = _config.Inbound.First().SniffingEnabled;
inbound.sniff_override_destination = _config.Inbound.First().RouteOnly ? false : _config.Inbound.First().SniffingEnabled;
inbound.domain_strategy = Utils.IsNullOrEmpty(_config.RoutingBasicItem.DomainStrategy4Singbox) ? null : _config.RoutingBasicItem.DomainStrategy4Singbox;
inbound.domain_strategy = _config.RoutingBasicItem.DomainStrategy4Singbox.IsNullOrEmpty() ? null : _config.RoutingBasicItem.DomainStrategy4Singbox;
var routing = await ConfigHandler.GetDefaultRouting(_config);
if (routing.DomainStrategy4Singbox.IsNotEmpty())
@ -601,7 +601,7 @@ namespace ServiceLib.Services.CoreConfig
{
_config.TunModeItem.Mtu = Global.TunMtus.First();
}
if (Utils.IsNullOrEmpty(_config.TunModeItem.Stack))
if (_config.TunModeItem.Stack.IsNullOrEmpty())
{
_config.TunModeItem.Stack = Global.TunStacks.First();
}
@ -698,7 +698,7 @@ namespace ServiceLib.Services.CoreConfig
outbound.packet_encoding = "xudp";
if (Utils.IsNullOrEmpty(node.Flow))
if (node.Flow.IsNullOrEmpty())
{
await GenOutboundMux(node, outbound);
}
@ -854,8 +854,8 @@ namespace ServiceLib.Services.CoreConfig
{
case nameof(ETransport.h2):
transport.type = nameof(ETransport.http);
transport.host = Utils.IsNullOrEmpty(node.RequestHost) ? null : Utils.String2List(node.RequestHost);
transport.path = Utils.IsNullOrEmpty(node.Path) ? null : node.Path;
transport.host = node.RequestHost.IsNullOrEmpty() ? null : Utils.String2List(node.RequestHost);
transport.path = node.Path.IsNullOrEmpty() ? null : node.Path;
break;
case nameof(ETransport.tcp): //http
@ -869,15 +869,15 @@ namespace ServiceLib.Services.CoreConfig
else
{
transport.type = nameof(ETransport.http);
transport.host = Utils.IsNullOrEmpty(node.RequestHost) ? null : Utils.String2List(node.RequestHost);
transport.path = Utils.IsNullOrEmpty(node.Path) ? null : node.Path;
transport.host = node.RequestHost.IsNullOrEmpty() ? null : Utils.String2List(node.RequestHost);
transport.path = node.Path.IsNullOrEmpty() ? null : node.Path;
}
}
break;
case nameof(ETransport.ws):
transport.type = nameof(ETransport.ws);
transport.path = Utils.IsNullOrEmpty(node.Path) ? null : node.Path;
transport.path = node.Path.IsNullOrEmpty() ? null : node.Path;
if (node.RequestHost.IsNotEmpty())
{
transport.headers = new()
@ -889,8 +889,8 @@ namespace ServiceLib.Services.CoreConfig
case nameof(ETransport.httpupgrade):
transport.type = nameof(ETransport.httpupgrade);
transport.path = Utils.IsNullOrEmpty(node.Path) ? null : node.Path;
transport.host = Utils.IsNullOrEmpty(node.RequestHost) ? null : node.RequestHost;
transport.path = node.Path.IsNullOrEmpty() ? null : node.Path;
transport.host = node.RequestHost.IsNullOrEmpty() ? null : node.RequestHost;
break;
@ -1241,11 +1241,11 @@ namespace ServiceLib.Services.CoreConfig
var strDNS = string.Empty;
if (_config.TunModeItem.EnableTun)
{
strDNS = Utils.IsNullOrEmpty(item?.TunDNS) ? EmbedUtils.GetEmbedText(Global.TunSingboxDNSFileName) : item?.TunDNS;
strDNS = string.IsNullOrEmpty(item?.TunDNS) ? EmbedUtils.GetEmbedText(Global.TunSingboxDNSFileName) : item?.TunDNS;
}
else
{
strDNS = Utils.IsNullOrEmpty(item?.NormalDNS) ? EmbedUtils.GetEmbedText(Global.DNSSingboxNormalFileName) : item?.NormalDNS;
strDNS = string.IsNullOrEmpty(item?.NormalDNS) ? EmbedUtils.GetEmbedText(Global.DNSSingboxNormalFileName) : item?.NormalDNS;
}
var dns4Sbox = JsonUtils.Deserialize<Dns4Sbox>(strDNS);
@ -1274,9 +1274,9 @@ namespace ServiceLib.Services.CoreConfig
dns4Sbox.servers.Add(new()
{
tag = tag,
address = Utils.IsNullOrEmpty(dNSItem?.DomainDNSAddress) ? Global.SingboxDomainDNSAddress.FirstOrDefault() : dNSItem?.DomainDNSAddress,
address = string.IsNullOrEmpty(dNSItem?.DomainDNSAddress) ? Global.SingboxDomainDNSAddress.FirstOrDefault() : dNSItem?.DomainDNSAddress,
detour = Global.DirectTag,
strategy = Utils.IsNullOrEmpty(dNSItem?.DomainStrategy4Freedom) ? null : dNSItem?.DomainStrategy4Freedom,
strategy = string.IsNullOrEmpty(dNSItem?.DomainStrategy4Freedom) ? null : dNSItem?.DomainStrategy4Freedom,
});
dns4Sbox.rules.Insert(0, new()
{
@ -1414,7 +1414,7 @@ namespace ServiceLib.Services.CoreConfig
singboxConfig.route.rule_set = [];
foreach (var item in new HashSet<string>(ruleSets))
{
if (Utils.IsNullOrEmpty(item))
if (item.IsNullOrEmpty())
{ continue; }
var customRuleset = customRulesets.FirstOrDefault(t => t.tag != null && t.tag.Equals(item));
if (customRuleset is null)

View file

@ -37,7 +37,7 @@ namespace ServiceLib.Services.CoreConfig
ret.Msg = ResUI.InitialConfiguration;
var result = EmbedUtils.GetEmbedText(Global.V2raySampleClient);
if (Utils.IsNullOrEmpty(result))
if (result.IsNullOrEmpty())
{
ret.Msg = ResUI.FailedGetDefaultConfiguration;
return ret;
@ -93,7 +93,7 @@ namespace ServiceLib.Services.CoreConfig
string result = EmbedUtils.GetEmbedText(Global.V2raySampleClient);
string txtOutbound = EmbedUtils.GetEmbedText(Global.V2raySampleOutbound);
if (Utils.IsNullOrEmpty(result) || txtOutbound.IsNullOrEmpty())
if (result.IsNullOrEmpty() || txtOutbound.IsNullOrEmpty())
{
ret.Msg = ResUI.FailedGetDefaultConfiguration;
return ret;
@ -135,7 +135,7 @@ namespace ServiceLib.Services.CoreConfig
}
if (it.ConfigType is EConfigType.VMess or EConfigType.VLESS)
{
if (Utils.IsNullOrEmpty(item.Id) || !Utils.IsGuidByParse(item.Id))
if (item.Id.IsNullOrEmpty() || !Utils.IsGuidByParse(item.Id))
{
continue;
}
@ -216,7 +216,7 @@ namespace ServiceLib.Services.CoreConfig
var result = EmbedUtils.GetEmbedText(Global.V2raySampleClient);
var txtOutbound = EmbedUtils.GetEmbedText(Global.V2raySampleOutbound);
if (Utils.IsNullOrEmpty(result) || txtOutbound.IsNullOrEmpty())
if (result.IsNullOrEmpty() || txtOutbound.IsNullOrEmpty())
{
ret.Msg = ResUI.FailedGetDefaultConfiguration;
return ret;
@ -261,7 +261,7 @@ namespace ServiceLib.Services.CoreConfig
var item = await AppHandler.Instance.GetProfileItem(it.IndexId);
if (it.ConfigType is EConfigType.VMess or EConfigType.VLESS)
{
if (item is null || Utils.IsNullOrEmpty(item.Id) || !Utils.IsGuidByParse(item.Id))
if (item is null || item.Id.IsNullOrEmpty() || !Utils.IsGuidByParse(item.Id))
{
continue;
}
@ -371,7 +371,7 @@ namespace ServiceLib.Services.CoreConfig
}
var result = EmbedUtils.GetEmbedText(Global.V2raySampleClient);
if (Utils.IsNullOrEmpty(result))
if (result.IsNullOrEmpty())
{
ret.Msg = ResUI.FailedGetDefaultConfiguration;
return ret;
@ -487,7 +487,7 @@ namespace ServiceLib.Services.CoreConfig
private Inbounds4Ray GetInbound(InItem inItem, EInboundProtocol protocol, bool bSocks)
{
string result = EmbedUtils.GetEmbedText(Global.V2raySampleInbound);
if (Utils.IsNullOrEmpty(result))
if (result.IsNullOrEmpty())
{
return new();
}
@ -515,7 +515,7 @@ namespace ServiceLib.Services.CoreConfig
if (v2rayConfig.routing?.rules != null)
{
v2rayConfig.routing.domainStrategy = _config.RoutingBasicItem.DomainStrategy;
v2rayConfig.routing.domainMatcher = Utils.IsNullOrEmpty(_config.RoutingBasicItem.DomainMatcher) ? null : _config.RoutingBasicItem.DomainMatcher;
v2rayConfig.routing.domainMatcher = _config.RoutingBasicItem.DomainMatcher.IsNullOrEmpty() ? null : _config.RoutingBasicItem.DomainMatcher;
var routing = await ConfigHandler.GetDefaultRouting(_config);
if (routing != null)
@ -551,11 +551,11 @@ namespace ServiceLib.Services.CoreConfig
{
return 0;
}
if (Utils.IsNullOrEmpty(rule.port))
if (rule.port.IsNullOrEmpty())
{
rule.port = null;
}
if (Utils.IsNullOrEmpty(rule.network))
if (rule.network.IsNullOrEmpty())
{
rule.network = null;
}
@ -1027,7 +1027,7 @@ namespace ServiceLib.Services.CoreConfig
case nameof(ETransport.grpc):
GrpcSettings4Ray grpcSettings = new()
{
authority = Utils.IsNullOrEmpty(host) ? null : host,
authority = host.IsNullOrEmpty() ? null : host,
serviceName = path,
multiMode = node.HeaderType == Global.GrpcMultiMode,
idle_timeout = _config.GrpcItem.IdleTimeout,
@ -1085,7 +1085,7 @@ namespace ServiceLib.Services.CoreConfig
var item = await AppHandler.Instance.GetDNSItem(ECoreType.Xray);
var normalDNS = item?.NormalDNS;
var domainStrategy4Freedom = item?.DomainStrategy4Freedom;
if (Utils.IsNullOrEmpty(normalDNS))
if (normalDNS.IsNullOrEmpty())
{
normalDNS = EmbedUtils.GetEmbedText(Global.DNSV2rayNormalFileName);
}
@ -1156,7 +1156,7 @@ namespace ServiceLib.Services.CoreConfig
{
var dnsServer = new DnsServer4Ray()
{
address = Utils.IsNullOrEmpty(dNSItem?.DomainDNSAddress) ? Global.DomainDNSAddress.FirstOrDefault() : dNSItem?.DomainDNSAddress,
address = string.IsNullOrEmpty(dNSItem?.DomainDNSAddress) ? Global.DomainDNSAddress.FirstOrDefault() : dNSItem?.DomainDNSAddress,
domains = [node.Address]
};
servers.AsArray().Add(JsonUtils.SerializeToNode(dnsServer));

View file

@ -160,7 +160,7 @@ namespace ServiceLib.Services
UseProxy = webProxy != null
});
if (Utils.IsNullOrEmpty(userAgent))
if (userAgent.IsNullOrEmpty())
{
userAgent = Utils.GetVersion(false);
}
@ -201,7 +201,7 @@ namespace ServiceLib.Services
var webProxy = await GetWebProxy(blProxy);
if (Utils.IsNullOrEmpty(userAgent))
if (userAgent.IsNullOrEmpty())
{
userAgent = Utils.GetVersion(false);
}

View file

@ -123,7 +123,7 @@ namespace ServiceLib.Services
var url = item.Url.TrimEx();
var userAgent = item.UserAgent.TrimEx();
var hashCode = $"{item.Remarks}->";
if (Utils.IsNullOrEmpty(id) || Utils.IsNullOrEmpty(url) || (subId.IsNotEmpty() && item.Id != subId))
if (id.IsNullOrEmpty() || url.IsNullOrEmpty() || (subId.IsNotEmpty() && item.Id != subId))
{
//_updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgNoValidSubscription}");
continue;
@ -151,7 +151,7 @@ namespace ServiceLib.Services
//convert
if (item.ConvertTarget.IsNotEmpty())
{
var subConvertUrl = Utils.IsNullOrEmpty(config.ConstItem.SubConvertUrl) ? Global.SubConvertUrls.FirstOrDefault() : config.ConstItem.SubConvertUrl;
var subConvertUrl = config.ConstItem.SubConvertUrl.IsNullOrEmpty() ? Global.SubConvertUrls.FirstOrDefault() : config.ConstItem.SubConvertUrl;
url = string.Format(subConvertUrl!, Utils.UrlEncode(url));
if (!url.Contains("target="))
{
@ -163,13 +163,13 @@ namespace ServiceLib.Services
}
}
var result = await downloadHandle.TryDownloadString(url, blProxy, userAgent);
if (blProxy && Utils.IsNullOrEmpty(result))
if (blProxy && result.IsNullOrEmpty())
{
result = await downloadHandle.TryDownloadString(url, false, userAgent);
}
//more url
if (Utils.IsNullOrEmpty(item.ConvertTarget) && item.MoreUrl.TrimEx().IsNotEmpty())
if (item.ConvertTarget.IsNullOrEmpty() && item.MoreUrl.TrimEx().IsNotEmpty())
{
if (result.IsNotEmpty() && Utils.IsBase64String(result))
{
@ -180,13 +180,13 @@ namespace ServiceLib.Services
foreach (var it in lstUrl)
{
var url2 = Utils.GetPunycode(it);
if (Utils.IsNullOrEmpty(url2))
if (url2.IsNullOrEmpty())
{
continue;
}
var result2 = await downloadHandle.TryDownloadString(url2, blProxy, userAgent);
if (blProxy && Utils.IsNullOrEmpty(result2))
if (blProxy && result2.IsNullOrEmpty())
{
result2 = await downloadHandle.TryDownloadString(url2, false, userAgent);
}
@ -204,7 +204,7 @@ namespace ServiceLib.Services
}
}
if (Utils.IsNullOrEmpty(result))
if (result.IsNullOrEmpty())
{
_updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgSubscriptionDecodingFailed}");
}
@ -287,7 +287,7 @@ namespace ServiceLib.Services
{
var url = coreInfo?.ReleaseApiUrl;
var result = await downloadHandle.TryDownloadString(url, true, Global.AppName);
if (Utils.IsNullOrEmpty(result))
if (result.IsNullOrEmpty())
{
return new RetResult(false, "");
}

View file

@ -43,13 +43,13 @@ namespace ServiceLib.ViewModels
private async Task SaveServerAsync()
{
string remarks = SelectedSource.Remarks;
if (Utils.IsNullOrEmpty(remarks))
if (remarks.IsNullOrEmpty())
{
NoticeHandler.Instance.Enqueue(ResUI.PleaseFillRemarks);
return;
}
if (Utils.IsNullOrEmpty(SelectedSource.Address))
if (SelectedSource.Address.IsNullOrEmpty())
{
NoticeHandler.Instance.Enqueue(ResUI.FillServerAddressCustom);
return;
@ -69,7 +69,7 @@ namespace ServiceLib.ViewModels
public async Task BrowseServer(string fileName)
{
if (Utils.IsNullOrEmpty(fileName))
if (fileName.IsNullOrEmpty())
{
return;
}
@ -95,7 +95,7 @@ namespace ServiceLib.ViewModels
private async Task EditServer()
{
var address = SelectedSource.Address;
if (Utils.IsNullOrEmpty(address))
if (address.IsNullOrEmpty())
{
NoticeHandler.Instance.Enqueue(ResUI.FillServerAddressCustom);
return;

View file

@ -41,19 +41,19 @@ namespace ServiceLib.ViewModels
private async Task SaveServerAsync()
{
if (Utils.IsNullOrEmpty(SelectedSource.Remarks))
if (SelectedSource.Remarks.IsNullOrEmpty())
{
NoticeHandler.Instance.Enqueue(ResUI.PleaseFillRemarks);
return;
}
if (Utils.IsNullOrEmpty(SelectedSource.Address))
if (SelectedSource.Address.IsNullOrEmpty())
{
NoticeHandler.Instance.Enqueue(ResUI.FillServerAddress);
return;
}
var port = SelectedSource.Port.ToString();
if (Utils.IsNullOrEmpty(port) || !Utils.IsNumeric(port)
if (port.IsNullOrEmpty() || !Utils.IsNumeric(port)
|| SelectedSource.Port <= 0 || SelectedSource.Port >= Global.MaxPort)
{
NoticeHandler.Instance.Enqueue(ResUI.FillCorrectServerPort);
@ -61,12 +61,12 @@ namespace ServiceLib.ViewModels
}
if (SelectedSource.ConfigType == EConfigType.Shadowsocks)
{
if (Utils.IsNullOrEmpty(SelectedSource.Id))
if (SelectedSource.Id.IsNullOrEmpty())
{
NoticeHandler.Instance.Enqueue(ResUI.FillPassword);
return;
}
if (Utils.IsNullOrEmpty(SelectedSource.Security))
if (SelectedSource.Security.IsNullOrEmpty())
{
NoticeHandler.Instance.Enqueue(ResUI.PleaseSelectEncryption);
return;
@ -75,7 +75,7 @@ namespace ServiceLib.ViewModels
if (SelectedSource.ConfigType != EConfigType.SOCKS
&& SelectedSource.ConfigType != EConfigType.HTTP)
{
if (Utils.IsNullOrEmpty(SelectedSource.Id))
if (SelectedSource.Id.IsNullOrEmpty())
{
NoticeHandler.Instance.Enqueue(ResUI.FillUUID);
return;

View file

@ -114,7 +114,7 @@ namespace ServiceLib.ViewModels
public async Task LocalRestore(string fileName)
{
DisplayOperationMsg();
if (Utils.IsNullOrEmpty(fileName))
if (fileName.IsNullOrEmpty())
{
return;
}
@ -164,7 +164,7 @@ namespace ServiceLib.ViewModels
private async Task<bool> CreateZipFileFromDirectory(string fileName)
{
if (Utils.IsNullOrEmpty(fileName))
if (fileName.IsNullOrEmpty())
{
return false;
}

View file

@ -100,7 +100,7 @@ namespace ServiceLib.ViewModels
var lstModel = new List<ClashConnectionModel>();
foreach (var item in connections ?? new())
{
var host = $"{(Utils.IsNullOrEmpty(item.metadata.host) ? item.metadata.destinationIP : item.metadata.host)}:{item.metadata.destinationPort}";
var host = $"{(item.metadata.host.IsNullOrEmpty() ? item.metadata.destinationIP : item.metadata.host)}:{item.metadata.destinationPort}";
if (HostFilter.IsNotEmpty() && !host.Contains(HostFilter))
{
continue;

View file

@ -193,7 +193,7 @@ namespace ServiceLib.ViewModels
{
foreach (var it in proxyGroups)
{
if (Utils.IsNullOrEmpty(it.name) || !_proxies.ContainsKey(it.name))
if (it.name.IsNullOrEmpty() || !_proxies.ContainsKey(it.name))
{
continue;
}
@ -256,7 +256,7 @@ namespace ServiceLib.ViewModels
return;
}
var name = SelectedGroup?.Name;
if (Utils.IsNullOrEmpty(name))
if (name.IsNullOrEmpty())
{
return;
}
@ -341,21 +341,21 @@ namespace ServiceLib.ViewModels
public async Task SetActiveProxy()
{
if (SelectedGroup == null || Utils.IsNullOrEmpty(SelectedGroup.Name))
if (SelectedGroup == null || SelectedGroup.Name.IsNullOrEmpty())
{
return;
}
if (SelectedDetail == null || Utils.IsNullOrEmpty(SelectedDetail.Name))
if (SelectedDetail == null || SelectedDetail.Name.IsNullOrEmpty())
{
return;
}
var name = SelectedGroup.Name;
if (Utils.IsNullOrEmpty(name))
if (name.IsNullOrEmpty())
{
return;
}
var nameNode = SelectedDetail.Name;
if (Utils.IsNullOrEmpty(nameNode))
if (nameNode.IsNullOrEmpty())
{
return;
}
@ -390,7 +390,7 @@ namespace ServiceLib.ViewModels
await GetClashProxies(true);
return;
}
if (Utils.IsNullOrEmpty(result))
if (result.IsNullOrEmpty())
{
return;
}

View file

@ -421,7 +421,7 @@ namespace ServiceLib.ViewModels
public async Task ScanImageResult(string fileName)
{
if (Utils.IsNullOrEmpty(fileName))
if (fileName.IsNullOrEmpty())
{
return;
}
@ -432,7 +432,7 @@ namespace ServiceLib.ViewModels
private async Task AddScanResultAsync(string? result)
{
if (Utils.IsNullOrEmpty(result))
if (result.IsNullOrEmpty())
{
NoticeHandler.Instance.Enqueue(ResUI.NoValidQRcodeFound);
}

View file

@ -266,7 +266,7 @@ namespace ServiceLib.ViewModels
private async Task SaveSettingAsync()
{
if (Utils.IsNullOrEmpty(localPort.ToString()) || !Utils.IsNumeric(localPort.ToString())
if (localPort.ToString().IsNullOrEmpty() || !Utils.IsNumeric(localPort.ToString())
|| localPort <= 0 || localPort >= Global.MaxPort)
{
NoticeHandler.Instance.Enqueue(ResUI.FillLocalListeningPort);

View file

@ -267,7 +267,7 @@ namespace ServiceLib.ViewModels
public void SetSpeedTestResult(SpeedTestResult result)
{
if (Utils.IsNullOrEmpty(result.IndexId))
if (result.IndexId.IsNullOrEmpty())
{
NoticeHandler.Instance.SendMessageEx(result.Delay);
NoticeHandler.Instance.Enqueue(result.Delay);
@ -350,7 +350,7 @@ namespace ServiceLib.ViewModels
return;
}
_serverFilter = ServerFilter;
if (Utils.IsNullOrEmpty(_serverFilter))
if (_serverFilter.IsNullOrEmpty())
{
RefreshServers();
}
@ -476,7 +476,7 @@ namespace ServiceLib.ViewModels
public async Task EditServerAsync(EConfigType eConfigType)
{
if (Utils.IsNullOrEmpty(SelectedProfile?.IndexId))
if (string.IsNullOrEmpty(SelectedProfile?.IndexId))
{
return;
}
@ -557,7 +557,7 @@ namespace ServiceLib.ViewModels
public async Task SetDefaultServer()
{
if (Utils.IsNullOrEmpty(SelectedProfile?.IndexId))
if (string.IsNullOrEmpty(SelectedProfile?.IndexId))
{
return;
}
@ -566,7 +566,7 @@ namespace ServiceLib.ViewModels
public async Task SetDefaultServer(string indexId)
{
if (Utils.IsNullOrEmpty(indexId))
if (indexId.IsNullOrEmpty())
{
return;
}
@ -598,7 +598,7 @@ namespace ServiceLib.ViewModels
{
return;
}
if (Utils.IsNullOrEmpty(SelectedServer.ID))
if (SelectedServer.ID.IsNullOrEmpty())
{
return;
}
@ -614,7 +614,7 @@ namespace ServiceLib.ViewModels
return;
}
var url = FmtHandler.GetShareUri(item);
if (Utils.IsNullOrEmpty(url))
if (url.IsNullOrEmpty())
{
return;
}
@ -649,7 +649,7 @@ namespace ServiceLib.ViewModels
public async Task SortServer(string colName)
{
if (Utils.IsNullOrEmpty(colName))
if (colName.IsNullOrEmpty())
{
return;
}
@ -776,7 +776,7 @@ namespace ServiceLib.ViewModels
public async Task Export2ClientConfigResult(string fileName, ProfileItem item)
{
if (Utils.IsNullOrEmpty(fileName))
if (fileName.IsNullOrEmpty())
{
return;
}
@ -803,7 +803,7 @@ namespace ServiceLib.ViewModels
foreach (var it in lstSelecteds)
{
var url = FmtHandler.GetShareUri(it);
if (Utils.IsNullOrEmpty(url))
if (url.IsNullOrEmpty())
{
continue;
}

View file

@ -224,7 +224,7 @@ namespace ServiceLib.ViewModels
private async Task SaveRoutingAsync()
{
string remarks = SelectedRouting.Remarks;
if (Utils.IsNullOrEmpty(remarks))
if (remarks.IsNullOrEmpty())
{
NoticeHandler.Instance.Enqueue(ResUI.PleaseFillRemarks);
return;
@ -252,13 +252,13 @@ namespace ServiceLib.ViewModels
public async Task ImportRulesFromFileAsync(string fileName)
{
if (Utils.IsNullOrEmpty(fileName))
if (fileName.IsNullOrEmpty())
{
return;
}
var result = EmbedUtils.LoadResource(fileName);
if (Utils.IsNullOrEmpty(result))
if (result.IsNullOrEmpty())
{
return;
}
@ -288,7 +288,7 @@ namespace ServiceLib.ViewModels
private async Task ImportRulesFromUrl()
{
var url = SelectedRouting.Url;
if (Utils.IsNullOrEmpty(url))
if (url.IsNullOrEmpty())
{
NoticeHandler.Instance.Enqueue(ResUI.MsgNeedUrl);
return;
@ -311,7 +311,7 @@ namespace ServiceLib.ViewModels
{
blReplace = true;
}
if (Utils.IsNullOrEmpty(clipboardData))
if (clipboardData.IsNullOrEmpty())
{
return -1;
}

View file

@ -301,7 +301,7 @@ namespace ServiceLib.ViewModels
{
return;
}
if (Utils.IsNullOrEmpty(SelectedServer.ID))
if (SelectedServer.ID.IsNullOrEmpty())
{
return;
}

View file

@ -27,7 +27,7 @@ namespace ServiceLib.ViewModels
private async Task SaveSubAsync()
{
var remarks = SelectedSource.Remarks;
if (Utils.IsNullOrEmpty(remarks))
if (remarks.IsNullOrEmpty())
{
NoticeHandler.Instance.Enqueue(ResUI.PleaseFillRemarks);
return;

View file

@ -272,7 +272,7 @@ namespace v2rayN.Desktop.Views
cmbHeaderType.Items.Clear();
var network = cmbNetwork.SelectedItem.ToString();
if (Utils.IsNullOrEmpty(network))
if (network.IsNullOrEmpty())
{
cmbHeaderType.Items.Add(Global.None);
return;
@ -313,7 +313,7 @@ namespace v2rayN.Desktop.Views
private void SetTips()
{
var network = cmbNetwork.SelectedItem.ToString();
if (Utils.IsNullOrEmpty(network))
if (network.IsNullOrEmpty())
{
network = Global.DefaultNetwork;
}

View file

@ -196,7 +196,7 @@ namespace v2rayN.Desktop.Views
public async Task ShareServer(string url)
{
if (Utils.IsNullOrEmpty(url))
if (url.IsNullOrEmpty())
{
return;
}

View file

@ -69,7 +69,7 @@ namespace v2rayN.Desktop.Views
private async Task ShareSub(string url)
{
if (Utils.IsNullOrEmpty(url))
if (url.IsNullOrEmpty())
{
return;
}

View file

@ -56,7 +56,7 @@ namespace v2rayN.Handler
try
{
var item = await ConfigHandler.GetDefaultRouting(config);
if (item == null || Utils.IsNullOrEmpty(item.CustomIcon) || !File.Exists(item.CustomIcon))
if (item == null || item.CustomIcon.IsNullOrEmpty() || !File.Exists(item.CustomIcon))
{
return null;
}

View file

@ -267,7 +267,7 @@ namespace v2rayN.Views
cmbHeaderType.Items.Clear();
var network = cmbNetwork.SelectedItem.ToString();
if (Utils.IsNullOrEmpty(network))
if (network.IsNullOrEmpty())
{
cmbHeaderType.Items.Add(Global.None);
return;
@ -308,7 +308,7 @@ namespace v2rayN.Views
private void SetTips()
{
var network = cmbNetwork.SelectedItem.ToString();
if (Utils.IsNullOrEmpty(network))
if (network.IsNullOrEmpty())
{
network = Global.DefaultNetwork;
}

View file

@ -234,10 +234,10 @@ namespace v2rayN.Views
// continue;
//}
var fontFamily = glyph.Win32FamilyNames[new CultureInfo(culture)];
if (Utils.IsNullOrEmpty(fontFamily))
if (fontFamily.IsNullOrEmpty())
{
fontFamily = glyph.Win32FamilyNames[new CultureInfo(culture2)];
if (Utils.IsNullOrEmpty(fontFamily))
if (fontFamily.IsNullOrEmpty())
{
continue;
}

View file

@ -65,7 +65,7 @@ namespace v2rayN.Views
private async void ShareSub(string url)
{
if (Utils.IsNullOrEmpty(url))
if (url.IsNullOrEmpty())
{
return;
}