diff --git a/v2rayN/ServiceLib/Common/DownloaderHelper.cs b/v2rayN/ServiceLib/Common/DownloaderHelper.cs
index a7870041..1da4870c 100644
--- a/v2rayN/ServiceLib/Common/DownloaderHelper.cs
+++ b/v2rayN/ServiceLib/Common/DownloaderHelper.cs
@@ -18,7 +18,7 @@ namespace ServiceLib.Common
Uri uri = new(url);
//Authorization Header
var headers = new WebHeaderCollection();
- if (Utils.IsNotEmpty(uri.UserInfo))
+ if (uri.UserInfo.IsNotEmpty())
{
headers.Add(HttpRequestHeader.Authorization, "Basic " + Utils.Base64Encode(uri.UserInfo));
}
diff --git a/v2rayN/ServiceLib/Common/FileManager.cs b/v2rayN/ServiceLib/Common/FileManager.cs
index 4431fbea..c5e80794 100644
--- a/v2rayN/ServiceLib/Common/FileManager.cs
+++ b/v2rayN/ServiceLib/Common/FileManager.cs
@@ -99,7 +99,7 @@ namespace ServiceLib.Common
}
try
{
- if (Utils.IsNotEmpty(ignoredName) && entry.Name.Contains(ignoredName))
+ if (ignoredName.IsNotEmpty() && entry.Name.Contains(ignoredName))
{
continue;
}
@@ -174,7 +174,7 @@ namespace ServiceLib.Common
// Get the files in the source directory and copy to the destination directory
foreach (var file in dir.GetFiles())
{
- if (Utils.IsNotEmpty(ignoredName) && file.Name.Contains(ignoredName))
+ if (ignoredName.IsNotEmpty() && file.Name.Contains(ignoredName))
{
continue;
}
diff --git a/v2rayN/ServiceLib/Common/QRCodeHelper.cs b/v2rayN/ServiceLib/Common/QRCodeHelper.cs
index 7a024a3e..5cd5ac25 100644
--- a/v2rayN/ServiceLib/Common/QRCodeHelper.cs
+++ b/v2rayN/ServiceLib/Common/QRCodeHelper.cs
@@ -60,7 +60,7 @@ namespace ServiceLib.Common
var reader = new BarcodeReader();
var result = reader.Decode(bitmap);
- if (result != null && Utils.IsNotEmpty(result.Text))
+ if (result != null && result.Text.IsNotEmpty())
{
return result.Text;
}
diff --git a/v2rayN/ServiceLib/Common/StringEx.cs b/v2rayN/ServiceLib/Common/StringEx.cs
index ab21016a..adeca8a2 100644
--- a/v2rayN/ServiceLib/Common/StringEx.cs
+++ b/v2rayN/ServiceLib/Common/StringEx.cs
@@ -6,7 +6,7 @@ namespace ServiceLib.Common
{
public static bool IsNullOrEmpty([NotNullWhen(false)] this string? value)
{
- return string.IsNullOrEmpty(value);
+ return string.IsNullOrEmpty(value) || string.IsNullOrWhiteSpace(value);
}
public static bool IsNullOrWhiteSpace([NotNullWhen(false)] this string? value)
diff --git a/v2rayN/ServiceLib/Common/Utils.cs b/v2rayN/ServiceLib/Common/Utils.cs
index 7e345eef..38221a2b 100644
--- a/v2rayN/ServiceLib/Common/Utils.cs
+++ b/v2rayN/ServiceLib/Common/Utils.cs
@@ -363,11 +363,6 @@ namespace ServiceLib.Common
return text == "null";
}
- public static bool IsNotEmpty(string? text)
- {
- return !string.IsNullOrEmpty(text);
- }
-
///
/// 验证Domain地址是否合法
///
diff --git a/v2rayN/ServiceLib/Handler/AppHandler.cs b/v2rayN/ServiceLib/Handler/AppHandler.cs
index 8a17932f..5c514696 100644
--- a/v2rayN/ServiceLib/Handler/AppHandler.cs
+++ b/v2rayN/ServiceLib/Handler/AppHandler.cs
@@ -153,11 +153,11 @@ namespace ServiceLib.Handler
from ProfileItem a
left join SubItem b on a.subid = b.id
where 1=1 ";
- if (Utils.IsNotEmpty(subid))
+ if (subid.IsNotEmpty())
{
sql += $" and a.subid = '{subid}'";
}
- if (Utils.IsNotEmpty(filter))
+ if (filter.IsNotEmpty())
{
if (filter.Contains('\''))
{
diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs
index 0016de60..c506db10 100644
--- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs
+++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs
@@ -22,7 +22,7 @@ namespace ServiceLib.Handler
{
Config? config = null;
var result = EmbedUtils.LoadResource(Utils.GetConfigPath(_configRes));
- if (Utils.IsNotEmpty(result))
+ if (result.IsNotEmpty())
{
config = JsonUtils.Deserialize(result);
}
@@ -858,7 +858,7 @@ namespace ServiceLib.Handler
{
return -1;
}
- if (Utils.IsNotEmpty(profileItem.Security) && profileItem.Security != Global.None)
+ if (profileItem.Security.IsNotEmpty() && profileItem.Security != Global.None)
{
profileItem.Security = Global.None;
}
@@ -897,7 +897,7 @@ namespace ServiceLib.Handler
{
profileItem.ConfigVersion = 2;
- if (Utils.IsNotEmpty(profileItem.StreamSecurity))
+ if (profileItem.StreamSecurity.IsNotEmpty())
{
if (profileItem.StreamSecurity != Global.StreamSecurity
&& profileItem.StreamSecurity != Global.StreamSecurityReality)
@@ -917,7 +917,7 @@ namespace ServiceLib.Handler
}
}
- if (Utils.IsNotEmpty(profileItem.Network) && !Global.Networks.Contains(profileItem.Network))
+ if (profileItem.Network.IsNotEmpty() && !Global.Networks.Contains(profileItem.Network))
{
profileItem.Network = Global.DefaultNetwork;
}
@@ -1091,7 +1091,7 @@ namespace ServiceLib.Handler
var subFilter = string.Empty;
//remove sub items
- if (isSub && Utils.IsNotEmpty(subid))
+ if (isSub && subid.IsNotEmpty())
{
await RemoveServersViaSubid(config, subid, isSub);
subFilter = (await AppHandler.Instance.GetSubItem(subid))?.Filter ?? "";
@@ -1122,7 +1122,7 @@ namespace ServiceLib.Handler
}
//exist sub items //filter
- if (isSub && Utils.IsNotEmpty(subid) && Utils.IsNotEmpty(subFilter))
+ if (isSub && subid.IsNotEmpty() && subFilter.IsNotEmpty())
{
if (!Regex.IsMatch(profileItem.Remarks, subFilter))
{
@@ -1185,7 +1185,7 @@ namespace ServiceLib.Handler
}
if (lstProfiles != null && lstProfiles.Count > 0)
{
- if (isSub && Utils.IsNotEmpty(subid))
+ if (isSub && subid.IsNotEmpty())
{
await RemoveServersViaSubid(config, subid, isSub);
}
@@ -1241,7 +1241,7 @@ namespace ServiceLib.Handler
return -1;
}
- if (isSub && Utils.IsNotEmpty(subid))
+ if (isSub && subid.IsNotEmpty())
{
await RemoveServersViaSubid(config, subid, isSub);
}
@@ -1266,7 +1266,7 @@ namespace ServiceLib.Handler
return -1;
}
- if (isSub && Utils.IsNotEmpty(subid))
+ if (isSub && subid.IsNotEmpty())
{
await RemoveServersViaSubid(config, subid, isSub);
}
@@ -1299,7 +1299,7 @@ namespace ServiceLib.Handler
}
List? lstOriSub = null;
ProfileItem? activeProfile = null;
- if (isSub && Utils.IsNotEmpty(subid))
+ if (isSub && subid.IsNotEmpty())
{
lstOriSub = await AppHandler.Instance.ProfileItems(subid);
activeProfile = lstOriSub?.FirstOrDefault(t => t.IndexId == config.IndexId);
diff --git a/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs b/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs
index 11982882..0d9b2a0e 100644
--- a/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs
+++ b/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs
@@ -33,7 +33,7 @@ namespace ServiceLib.Handler
{
return result;
}
- if (Utils.IsNotEmpty(fileName) && result.Data != null)
+ if (fileName.IsNotEmpty() && result.Data != null)
{
await File.WriteAllTextAsync(fileName, result.Data.ToString());
}
diff --git a/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs
index 276cd44d..2fa844a2 100644
--- a/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs
+++ b/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs
@@ -16,12 +16,12 @@ namespace ServiceLib.Handler.Fmt
protected static int GetStdTransport(ProfileItem item, string? securityDef, ref Dictionary dicQuery)
{
- if (Utils.IsNotEmpty(item.Flow))
+ if (item.Flow.IsNotEmpty())
{
dicQuery.Add("flow", item.Flow);
}
- if (Utils.IsNotEmpty(item.StreamSecurity))
+ if (item.StreamSecurity.IsNotEmpty())
{
dicQuery.Add("security", item.StreamSecurity);
}
@@ -32,27 +32,27 @@ namespace ServiceLib.Handler.Fmt
dicQuery.Add("security", securityDef);
}
}
- if (Utils.IsNotEmpty(item.Sni))
+ if (item.Sni.IsNotEmpty())
{
dicQuery.Add("sni", item.Sni);
}
- if (Utils.IsNotEmpty(item.Alpn))
+ if (item.Alpn.IsNotEmpty())
{
dicQuery.Add("alpn", Utils.UrlEncode(item.Alpn));
}
- if (Utils.IsNotEmpty(item.Fingerprint))
+ if (item.Fingerprint.IsNotEmpty())
{
dicQuery.Add("fp", Utils.UrlEncode(item.Fingerprint));
}
- if (Utils.IsNotEmpty(item.PublicKey))
+ if (item.PublicKey.IsNotEmpty())
{
dicQuery.Add("pbk", Utils.UrlEncode(item.PublicKey));
}
- if (Utils.IsNotEmpty(item.ShortId))
+ if (item.ShortId.IsNotEmpty())
{
dicQuery.Add("sid", Utils.UrlEncode(item.ShortId));
}
- if (Utils.IsNotEmpty(item.SpiderX))
+ if (item.SpiderX.IsNotEmpty())
{
dicQuery.Add("spx", Utils.UrlEncode(item.SpiderX));
}
@@ -61,21 +61,21 @@ namespace ServiceLib.Handler.Fmt
dicQuery.Add("allowInsecure", "1");
}
- dicQuery.Add("type", Utils.IsNotEmpty(item.Network) ? item.Network : nameof(ETransport.tcp));
+ dicQuery.Add("type", item.Network.IsNotEmpty() ? item.Network : nameof(ETransport.tcp));
switch (item.Network)
{
case nameof(ETransport.tcp):
- dicQuery.Add("headerType", Utils.IsNotEmpty(item.HeaderType) ? item.HeaderType : Global.None);
- if (Utils.IsNotEmpty(item.RequestHost))
+ dicQuery.Add("headerType", item.HeaderType.IsNotEmpty() ? item.HeaderType : Global.None);
+ if (item.RequestHost.IsNotEmpty())
{
dicQuery.Add("host", Utils.UrlEncode(item.RequestHost));
}
break;
case nameof(ETransport.kcp):
- dicQuery.Add("headerType", Utils.IsNotEmpty(item.HeaderType) ? item.HeaderType : Global.None);
- if (Utils.IsNotEmpty(item.Path))
+ dicQuery.Add("headerType", item.HeaderType.IsNotEmpty() ? item.HeaderType : Global.None);
+ if (item.Path.IsNotEmpty())
{
dicQuery.Add("seed", Utils.UrlEncode(item.Path));
}
@@ -83,30 +83,30 @@ namespace ServiceLib.Handler.Fmt
case nameof(ETransport.ws):
case nameof(ETransport.httpupgrade):
- if (Utils.IsNotEmpty(item.RequestHost))
+ if (item.RequestHost.IsNotEmpty())
{
dicQuery.Add("host", Utils.UrlEncode(item.RequestHost));
}
- if (Utils.IsNotEmpty(item.Path))
+ if (item.Path.IsNotEmpty())
{
dicQuery.Add("path", Utils.UrlEncode(item.Path));
}
break;
case nameof(ETransport.xhttp):
- if (Utils.IsNotEmpty(item.RequestHost))
+ if (item.RequestHost.IsNotEmpty())
{
dicQuery.Add("host", Utils.UrlEncode(item.RequestHost));
}
- if (Utils.IsNotEmpty(item.Path))
+ if (item.Path.IsNotEmpty())
{
dicQuery.Add("path", Utils.UrlEncode(item.Path));
}
- if (Utils.IsNotEmpty(item.HeaderType) && Global.XhttpMode.Contains(item.HeaderType))
+ if (item.HeaderType.IsNotEmpty() && Global.XhttpMode.Contains(item.HeaderType))
{
dicQuery.Add("mode", Utils.UrlEncode(item.HeaderType));
}
- if (Utils.IsNotEmpty(item.Extra))
+ if (item.Extra.IsNotEmpty())
{
dicQuery.Add("extra", Utils.UrlEncode(item.Extra));
}
@@ -115,24 +115,24 @@ namespace ServiceLib.Handler.Fmt
case nameof(ETransport.http):
case nameof(ETransport.h2):
dicQuery["type"] = nameof(ETransport.http);
- if (Utils.IsNotEmpty(item.RequestHost))
+ if (item.RequestHost.IsNotEmpty())
{
dicQuery.Add("host", Utils.UrlEncode(item.RequestHost));
}
- if (Utils.IsNotEmpty(item.Path))
+ if (item.Path.IsNotEmpty())
{
dicQuery.Add("path", Utils.UrlEncode(item.Path));
}
break;
case nameof(ETransport.quic):
- dicQuery.Add("headerType", Utils.IsNotEmpty(item.HeaderType) ? item.HeaderType : Global.None);
+ dicQuery.Add("headerType", item.HeaderType.IsNotEmpty() ? item.HeaderType : Global.None);
dicQuery.Add("quicSecurity", Utils.UrlEncode(item.RequestHost));
dicQuery.Add("key", Utils.UrlEncode(item.Path));
break;
case nameof(ETransport.grpc):
- if (Utils.IsNotEmpty(item.Path))
+ if (item.Path.IsNotEmpty())
{
dicQuery.Add("authority", Utils.UrlEncode(item.RequestHost));
dicQuery.Add("serviceName", Utils.UrlEncode(item.Path));
diff --git a/v2rayN/ServiceLib/Handler/Fmt/Hysteria2Fmt.cs b/v2rayN/ServiceLib/Handler/Fmt/Hysteria2Fmt.cs
index be6630e1..46e397b3 100644
--- a/v2rayN/ServiceLib/Handler/Fmt/Hysteria2Fmt.cs
+++ b/v2rayN/ServiceLib/Handler/Fmt/Hysteria2Fmt.cs
@@ -36,26 +36,26 @@ namespace ServiceLib.Handler.Fmt
string url = string.Empty;
string remark = string.Empty;
- if (Utils.IsNotEmpty(item.Remarks))
+ if (item.Remarks.IsNotEmpty())
{
remark = "#" + Utils.UrlEncode(item.Remarks);
}
var dicQuery = new Dictionary();
- if (Utils.IsNotEmpty(item.Sni))
+ if (item.Sni.IsNotEmpty())
{
dicQuery.Add("sni", item.Sni);
}
- if (Utils.IsNotEmpty(item.Alpn))
+ if (item.Alpn.IsNotEmpty())
{
dicQuery.Add("alpn", Utils.UrlEncode(item.Alpn));
}
- if (Utils.IsNotEmpty(item.Path))
+ if (item.Path.IsNotEmpty())
{
dicQuery.Add("obfs", "salamander");
dicQuery.Add("obfs-password", Utils.UrlEncode(item.Path));
}
dicQuery.Add("insecure", item.AllowInsecure.ToLower() == "true" ? "1" : "0");
- if (Utils.IsNotEmpty(item.Ports))
+ if (item.Ports.IsNotEmpty())
{
dicQuery.Add("mport", Utils.UrlEncode(item.Ports.Replace(':', '-')));
}
diff --git a/v2rayN/ServiceLib/Handler/Fmt/ShadowsocksFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/ShadowsocksFmt.cs
index a9ebac33..aaf7f3e0 100644
--- a/v2rayN/ServiceLib/Handler/Fmt/ShadowsocksFmt.cs
+++ b/v2rayN/ServiceLib/Handler/Fmt/ShadowsocksFmt.cs
@@ -31,7 +31,7 @@ namespace ServiceLib.Handler.Fmt
string url = string.Empty;
string remark = string.Empty;
- if (Utils.IsNotEmpty(item.Remarks))
+ if (item.Remarks.IsNotEmpty())
{
remark = "#" + Utils.UrlEncode(item.Remarks);
}
@@ -58,7 +58,7 @@ namespace ServiceLib.Handler.Fmt
ProfileItem item = new();
var base64 = match.Groups["base64"].Value.TrimEnd('/');
var tag = match.Groups["tag"].Value;
- if (Utils.IsNotEmpty(tag))
+ if (tag.IsNotEmpty())
{
item.Remarks = Utils.UrlDecode(tag);
}
@@ -122,7 +122,7 @@ namespace ServiceLib.Handler.Fmt
{
//obfs-host exists
var obfsHost = queryParameters["plugin"]?.Split(';').FirstOrDefault(t => t.Contains("obfs-host"));
- if (queryParameters["plugin"].Contains("obfs=http") && Utils.IsNotEmpty(obfsHost))
+ if (queryParameters["plugin"].Contains("obfs=http") && obfsHost.IsNotEmpty())
{
obfsHost = obfsHost?.Replace("obfs-host=", "");
item.Network = Global.DefaultNetwork;
diff --git a/v2rayN/ServiceLib/Handler/Fmt/SocksFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/SocksFmt.cs
index 3883fab8..0d9013b4 100644
--- a/v2rayN/ServiceLib/Handler/Fmt/SocksFmt.cs
+++ b/v2rayN/ServiceLib/Handler/Fmt/SocksFmt.cs
@@ -28,7 +28,7 @@ namespace ServiceLib.Handler.Fmt
var url = string.Empty;
var remark = string.Empty;
- if (Utils.IsNotEmpty(item.Remarks))
+ if (item.Remarks.IsNotEmpty())
{
remark = "#" + Utils.UrlEncode(item.Remarks);
}
diff --git a/v2rayN/ServiceLib/Handler/Fmt/TrojanFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/TrojanFmt.cs
index 1bd86379..afcaa194 100644
--- a/v2rayN/ServiceLib/Handler/Fmt/TrojanFmt.cs
+++ b/v2rayN/ServiceLib/Handler/Fmt/TrojanFmt.cs
@@ -33,7 +33,7 @@ namespace ServiceLib.Handler.Fmt
string url = string.Empty;
string remark = string.Empty;
- if (Utils.IsNotEmpty(item.Remarks))
+ if (item.Remarks.IsNotEmpty())
{
remark = "#" + Utils.UrlEncode(item.Remarks);
}
diff --git a/v2rayN/ServiceLib/Handler/Fmt/TuicFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/TuicFmt.cs
index 40993147..8fc23fbd 100644
--- a/v2rayN/ServiceLib/Handler/Fmt/TuicFmt.cs
+++ b/v2rayN/ServiceLib/Handler/Fmt/TuicFmt.cs
@@ -40,16 +40,16 @@ namespace ServiceLib.Handler.Fmt
string url = string.Empty;
string remark = string.Empty;
- if (Utils.IsNotEmpty(item.Remarks))
+ if (item.Remarks.IsNotEmpty())
{
remark = "#" + Utils.UrlEncode(item.Remarks);
}
var dicQuery = new Dictionary();
- if (Utils.IsNotEmpty(item.Sni))
+ if (item.Sni.IsNotEmpty())
{
dicQuery.Add("sni", item.Sni);
}
- if (Utils.IsNotEmpty(item.Alpn))
+ if (item.Alpn.IsNotEmpty())
{
dicQuery.Add("alpn", Utils.UrlEncode(item.Alpn));
}
diff --git a/v2rayN/ServiceLib/Handler/Fmt/VLESSFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/VLESSFmt.cs
index 4fc09765..20899afb 100644
--- a/v2rayN/ServiceLib/Handler/Fmt/VLESSFmt.cs
+++ b/v2rayN/ServiceLib/Handler/Fmt/VLESSFmt.cs
@@ -36,12 +36,12 @@ namespace ServiceLib.Handler.Fmt
string url = string.Empty;
string remark = string.Empty;
- if (Utils.IsNotEmpty(item.Remarks))
+ if (item.Remarks.IsNotEmpty())
{
remark = "#" + Utils.UrlEncode(item.Remarks);
}
var dicQuery = new Dictionary();
- if (Utils.IsNotEmpty(item.Security))
+ if (item.Security.IsNotEmpty())
{
dicQuery.Add("encryption", item.Security);
}
diff --git a/v2rayN/ServiceLib/Handler/Fmt/VmessFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/VmessFmt.cs
index a2058aeb..cf1eaa62 100644
--- a/v2rayN/ServiceLib/Handler/Fmt/VmessFmt.cs
+++ b/v2rayN/ServiceLib/Handler/Fmt/VmessFmt.cs
@@ -78,12 +78,12 @@ namespace ServiceLib.Handler.Fmt
item.AlterId = vmessQRCode.aid;
item.Security = Utils.ToString(vmessQRCode.scy);
- item.Security = Utils.IsNotEmpty(vmessQRCode.scy) ? vmessQRCode.scy : Global.DefaultSecurity;
- if (Utils.IsNotEmpty(vmessQRCode.net))
+ item.Security = vmessQRCode.scy.IsNotEmpty() ? vmessQRCode.scy : Global.DefaultSecurity;
+ if (vmessQRCode.net.IsNotEmpty())
{
item.Network = vmessQRCode.net;
}
- if (Utils.IsNotEmpty(vmessQRCode.type))
+ if (vmessQRCode.type.IsNotEmpty())
{
item.HeaderType = vmessQRCode.type;
}
diff --git a/v2rayN/ServiceLib/Handler/Fmt/WireguardFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/WireguardFmt.cs
index beb7d933..f36741ed 100644
--- a/v2rayN/ServiceLib/Handler/Fmt/WireguardFmt.cs
+++ b/v2rayN/ServiceLib/Handler/Fmt/WireguardFmt.cs
@@ -37,25 +37,25 @@ namespace ServiceLib.Handler.Fmt
string url = string.Empty;
string remark = string.Empty;
- if (Utils.IsNotEmpty(item.Remarks))
+ if (item.Remarks.IsNotEmpty())
{
remark = "#" + Utils.UrlEncode(item.Remarks);
}
var dicQuery = new Dictionary();
- if (Utils.IsNotEmpty(item.PublicKey))
+ if (item.PublicKey.IsNotEmpty())
{
dicQuery.Add("publickey", Utils.UrlEncode(item.PublicKey));
}
- if (Utils.IsNotEmpty(item.Path))
+ if (item.Path.IsNotEmpty())
{
dicQuery.Add("reserved", Utils.UrlEncode(item.Path));
}
- if (Utils.IsNotEmpty(item.RequestHost))
+ if (item.RequestHost.IsNotEmpty())
{
dicQuery.Add("address", Utils.UrlEncode(item.RequestHost));
}
- if (Utils.IsNotEmpty(item.ShortId))
+ if (item.ShortId.IsNotEmpty())
{
dicQuery.Add("mtu", Utils.UrlEncode(item.ShortId));
}
diff --git a/v2rayN/ServiceLib/Handler/ProfileExHandler.cs b/v2rayN/ServiceLib/Handler/ProfileExHandler.cs
index 31a6b56c..b9bc8735 100644
--- a/v2rayN/ServiceLib/Handler/ProfileExHandler.cs
+++ b/v2rayN/ServiceLib/Handler/ProfileExHandler.cs
@@ -36,7 +36,7 @@ namespace ServiceLib.Handler
private void IndexIdEnqueue(string indexId)
{
- if (Utils.IsNotEmpty(indexId) && !_queIndexIds.Contains(indexId))
+ if (indexId.IsNotEmpty() && !_queIndexIds.Contains(indexId))
{
_queIndexIds.Enqueue(indexId);
}
diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigClashService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigClashService.cs
index d64d22b7..4d3b5e87 100644
--- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigClashService.cs
+++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigClashService.cs
@@ -117,7 +117,7 @@ namespace ServiceLib.Services.CoreConfig
if (_config.TunModeItem.EnableTun)
{
var tun = EmbedUtils.GetEmbedText(Global.ClashTunYaml);
- if (Utils.IsNotEmpty(tun))
+ if (tun.IsNotEmpty())
{
var tunContent = YamlUtils.FromYaml>(tun);
if (tunContent != null)
diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs
index 475eed10..183fce0c 100644
--- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs
+++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs
@@ -563,7 +563,7 @@ namespace ServiceLib.Services.CoreConfig
inbound.domain_strategy = Utils.IsNullOrEmpty(_config.RoutingBasicItem.DomainStrategy4Singbox) ? null : _config.RoutingBasicItem.DomainStrategy4Singbox;
var routing = await ConfigHandler.GetDefaultRouting(_config);
- if (Utils.IsNotEmpty(routing.DomainStrategy4Singbox))
+ if (routing.DomainStrategy4Singbox.IsNotEmpty())
{
inbound.domain_strategy = routing.DomainStrategy4Singbox;
}
@@ -583,7 +583,7 @@ namespace ServiceLib.Services.CoreConfig
singboxConfig.inbounds.Add(inbound3);
//auth
- if (Utils.IsNotEmpty(_config.Inbound.First().User) && Utils.IsNotEmpty(_config.Inbound.First().Pass))
+ if (_config.Inbound.First().User.IsNotEmpty() && _config.Inbound.First().Pass.IsNotEmpty())
{
inbound3.users = new() { new() { username = _config.Inbound.First().User, password = _config.Inbound.First().Pass } };
}
@@ -674,8 +674,8 @@ namespace ServiceLib.Services.CoreConfig
case EConfigType.SOCKS:
{
outbound.version = "5";
- if (Utils.IsNotEmpty(node.Security)
- && Utils.IsNotEmpty(node.Id))
+ if (node.Security.IsNotEmpty()
+ && node.Id.IsNotEmpty())
{
outbound.username = node.Security;
outbound.password = node.Id;
@@ -684,8 +684,8 @@ namespace ServiceLib.Services.CoreConfig
}
case EConfigType.HTTP:
{
- if (Utils.IsNotEmpty(node.Security)
- && Utils.IsNotEmpty(node.Id))
+ if (node.Security.IsNotEmpty()
+ && node.Id.IsNotEmpty())
{
outbound.username = node.Security;
outbound.password = node.Id;
@@ -719,7 +719,7 @@ namespace ServiceLib.Services.CoreConfig
{
outbound.password = node.Id;
- if (Utils.IsNotEmpty(node.Path))
+ if (node.Path.IsNotEmpty())
{
outbound.obfs = new()
{
@@ -775,7 +775,7 @@ namespace ServiceLib.Services.CoreConfig
{
try
{
- if (_config.CoreBasicItem.MuxEnabled && Utils.IsNotEmpty(_config.Mux4SboxItem.Protocol))
+ if (_config.CoreBasicItem.MuxEnabled && _config.Mux4SboxItem.Protocol.IsNotEmpty())
{
var mux = new Multiplex4Sbox()
{
@@ -801,11 +801,11 @@ namespace ServiceLib.Services.CoreConfig
if (node.StreamSecurity == Global.StreamSecurityReality || node.StreamSecurity == Global.StreamSecurity)
{
var server_name = string.Empty;
- if (Utils.IsNotEmpty(node.Sni))
+ if (node.Sni.IsNotEmpty())
{
server_name = node.Sni;
}
- else if (Utils.IsNotEmpty(node.RequestHost))
+ else if (node.RequestHost.IsNotEmpty())
{
server_name = Utils.String2List(node.RequestHost)?.First();
}
@@ -816,7 +816,7 @@ namespace ServiceLib.Services.CoreConfig
insecure = Utils.ToBool(node.AllowInsecure.IsNullOrEmpty() ? _config.CoreBasicItem.DefAllowInsecure.ToString().ToLower() : node.AllowInsecure),
alpn = node.GetAlpn(),
};
- if (Utils.IsNotEmpty(node.Fingerprint))
+ if (node.Fingerprint.IsNotEmpty())
{
tls.utls = new Utls4Sbox()
{
@@ -878,7 +878,7 @@ namespace ServiceLib.Services.CoreConfig
case nameof(ETransport.ws):
transport.type = nameof(ETransport.ws);
transport.path = Utils.IsNullOrEmpty(node.Path) ? null : node.Path;
- if (Utils.IsNotEmpty(node.RequestHost))
+ if (node.RequestHost.IsNotEmpty())
{
transport.headers = new()
{
@@ -1085,7 +1085,7 @@ namespace ServiceLib.Services.CoreConfig
outbound = item.OutboundTag,
};
- if (Utils.IsNotEmpty(item.Port))
+ if (item.Port.IsNotEmpty())
{
if (item.Port.Contains("-"))
{
@@ -1096,7 +1096,7 @@ namespace ServiceLib.Services.CoreConfig
rule.port = new List { Utils.ToInt(item.Port) };
}
}
- if (Utils.IsNotEmpty(item.Network))
+ if (item.Network.IsNotEmpty())
{
rule.network = Utils.String2List(item.Network);
}
@@ -1290,7 +1290,7 @@ namespace ServiceLib.Services.CoreConfig
});
var lstDomain = singboxConfig.outbounds
- .Where(t => Utils.IsNotEmpty(t.server) && Utils.IsDomain(t.server))
+ .Where(t => t.server.IsNotEmpty() && Utils.IsDomain(t.server))
.Select(t => t.server)
.Distinct()
.ToList();
@@ -1394,10 +1394,10 @@ namespace ServiceLib.Services.CoreConfig
List customRulesets = [];
var routing = await ConfigHandler.GetDefaultRouting(_config);
- if (Utils.IsNotEmpty(routing.CustomRulesetPath4Singbox))
+ if (routing.CustomRulesetPath4Singbox.IsNotEmpty())
{
var result = EmbedUtils.LoadResource(routing.CustomRulesetPath4Singbox);
- if (Utils.IsNotEmpty(result))
+ if (result.IsNotEmpty())
{
customRulesets = (JsonUtils.Deserialize>(result) ?? [])
.Where(t => t.tag != null)
diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs
index f07a9c94..30d45644 100644
--- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs
+++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs
@@ -465,7 +465,7 @@ namespace ServiceLib.Services.CoreConfig
v2rayConfig.inbounds.Add(inbound3);
//auth
- if (Utils.IsNotEmpty(_config.Inbound.First().User) && Utils.IsNotEmpty(_config.Inbound.First().Pass))
+ if (_config.Inbound.First().User.IsNotEmpty() && _config.Inbound.First().Pass.IsNotEmpty())
{
inbound3.settings.auth = "password";
inbound3.settings.accounts = new List { new AccountsItem4Ray() { user = _config.Inbound.First().User, pass = _config.Inbound.First().Pass } };
@@ -520,7 +520,7 @@ namespace ServiceLib.Services.CoreConfig
var routing = await ConfigHandler.GetDefaultRouting(_config);
if (routing != null)
{
- if (Utils.IsNotEmpty(routing.DomainStrategy))
+ if (routing.DomainStrategy.IsNotEmpty())
{
v2rayConfig.routing.domainStrategy = routing.DomainStrategy;
}
@@ -603,7 +603,7 @@ namespace ServiceLib.Services.CoreConfig
}
if (!hasDomainIp)
{
- if (Utils.IsNotEmpty(rule.port)
+ if (rule.port.IsNotEmpty()
|| rule.protocol?.Count > 0
|| rule.inboundTag?.Count > 0
)
@@ -714,8 +714,8 @@ namespace ServiceLib.Services.CoreConfig
serversItem.method = null;
serversItem.password = null;
- if (Utils.IsNotEmpty(node.Security)
- && Utils.IsNotEmpty(node.Id))
+ if (node.Security.IsNotEmpty()
+ && node.Id.IsNotEmpty())
{
SocksUsersItem4Ray socksUsersItem = new()
{
@@ -868,11 +868,11 @@ namespace ServiceLib.Services.CoreConfig
alpn = node.GetAlpn(),
fingerprint = node.Fingerprint.IsNullOrEmpty() ? _config.CoreBasicItem.DefFingerprint : node.Fingerprint
};
- if (Utils.IsNotEmpty(sni))
+ if (sni.IsNotEmpty())
{
tlsSettings.serverName = sni;
}
- else if (Utils.IsNotEmpty(host))
+ else if (host.IsNotEmpty())
{
tlsSettings.serverName = Utils.String2List(host)?.First();
}
@@ -918,7 +918,7 @@ namespace ServiceLib.Services.CoreConfig
type = node.HeaderType,
domain = host.IsNullOrEmpty() ? null : host
};
- if (Utils.IsNotEmpty(path))
+ if (path.IsNotEmpty())
{
kcpSettings.seed = path;
}
@@ -929,16 +929,16 @@ namespace ServiceLib.Services.CoreConfig
WsSettings4Ray wsSettings = new();
wsSettings.headers = new Headers4Ray();
- if (Utils.IsNotEmpty(host))
+ if (host.IsNotEmpty())
{
wsSettings.host = host;
wsSettings.headers.Host = host;
}
- if (Utils.IsNotEmpty(path))
+ if (path.IsNotEmpty())
{
wsSettings.path = path;
}
- if (Utils.IsNotEmpty(useragent))
+ if (useragent.IsNotEmpty())
{
wsSettings.headers.UserAgent = useragent;
}
@@ -949,11 +949,11 @@ namespace ServiceLib.Services.CoreConfig
case nameof(ETransport.httpupgrade):
HttpupgradeSettings4Ray httpupgradeSettings = new();
- if (Utils.IsNotEmpty(path))
+ if (path.IsNotEmpty())
{
httpupgradeSettings.path = path;
}
- if (Utils.IsNotEmpty(host))
+ if (host.IsNotEmpty())
{
httpupgradeSettings.host = host;
}
@@ -965,19 +965,19 @@ namespace ServiceLib.Services.CoreConfig
streamSettings.network = ETransport.xhttp.ToString();
XhttpSettings4Ray xhttpSettings = new();
- if (Utils.IsNotEmpty(path))
+ if (path.IsNotEmpty())
{
xhttpSettings.path = path;
}
- if (Utils.IsNotEmpty(host))
+ if (host.IsNotEmpty())
{
xhttpSettings.host = host;
}
- if (Utils.IsNotEmpty(node.HeaderType) && Global.XhttpMode.Contains(node.HeaderType))
+ if (node.HeaderType.IsNotEmpty() && Global.XhttpMode.Contains(node.HeaderType))
{
xhttpSettings.mode = node.HeaderType;
}
- if (Utils.IsNotEmpty(node.Extra))
+ if (node.Extra.IsNotEmpty())
{
xhttpSettings.extra = JsonUtils.ParseJson(node.Extra);
}
@@ -990,7 +990,7 @@ namespace ServiceLib.Services.CoreConfig
case nameof(ETransport.h2):
HttpSettings4Ray httpSettings = new();
- if (Utils.IsNotEmpty(host))
+ if (host.IsNotEmpty())
{
httpSettings.host = Utils.String2List(host);
}
@@ -1013,7 +1013,7 @@ namespace ServiceLib.Services.CoreConfig
streamSettings.quicSettings = quicsettings;
if (node.StreamSecurity == Global.StreamSecurity)
{
- if (Utils.IsNotEmpty(sni))
+ if (sni.IsNotEmpty())
{
streamSettings.tlsSettings.serverName = sni;
}
@@ -1058,7 +1058,7 @@ namespace ServiceLib.Services.CoreConfig
request = request.Replace("$requestUserAgent$", $"{useragent.AppendQuotes()}");
//Path
string pathHttp = @"/";
- if (Utils.IsNotEmpty(path))
+ if (path.IsNotEmpty())
{
string[] arrPath = path.Split(',');
pathHttp = string.Join(",".AppendQuotes(), arrPath);
@@ -1091,7 +1091,7 @@ namespace ServiceLib.Services.CoreConfig
}
//Outbound Freedom domainStrategy
- if (Utils.IsNotEmpty(domainStrategy4Freedom))
+ if (domainStrategy4Freedom.IsNotEmpty())
{
var outbound = v2rayConfig.outbounds.FirstOrDefault(t => t is { protocol: "freedom", tag: Global.DirectTag });
if (outbound != null)
@@ -1216,7 +1216,7 @@ namespace ServiceLib.Services.CoreConfig
{
//fragment proxy
if (_config.CoreBasicItem.EnableFragment
- && Utils.IsNotEmpty(v2rayConfig.outbounds.First().streamSettings?.security))
+ && v2rayConfig.outbounds.First().streamSettings?.security.IsNullOrEmpty() == false)
{
var fragmentOutbound = new Outbounds4Ray
{
diff --git a/v2rayN/ServiceLib/Services/DownloadService.cs b/v2rayN/ServiceLib/Services/DownloadService.cs
index e94dd9c2..86af7553 100644
--- a/v2rayN/ServiceLib/Services/DownloadService.cs
+++ b/v2rayN/ServiceLib/Services/DownloadService.cs
@@ -108,7 +108,7 @@ namespace ServiceLib.Services
try
{
var result1 = await DownloadStringAsync(url, blProxy, userAgent, 15);
- if (Utils.IsNotEmpty(result1))
+ if (result1.IsNotEmpty())
{
return result1;
}
@@ -126,7 +126,7 @@ namespace ServiceLib.Services
try
{
var result2 = await DownloadStringViaDownloader(url, blProxy, userAgent, 15);
- if (Utils.IsNotEmpty(result2))
+ if (result2.IsNotEmpty())
{
return result2;
}
@@ -168,7 +168,7 @@ namespace ServiceLib.Services
Uri uri = new(url);
//Authorization Header
- if (Utils.IsNotEmpty(uri.UserInfo))
+ if (uri.UserInfo.IsNotEmpty())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Utils.Base64Encode(uri.UserInfo));
}
diff --git a/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs b/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs
index 3eecee26..078e9a5e 100644
--- a/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs
+++ b/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs
@@ -87,7 +87,7 @@ namespace ServiceLib.Services.Statistics
while (!res.CloseStatus.HasValue)
{
var result = Encoding.UTF8.GetString(buffer, 0, res.Count);
- if (Utils.IsNotEmpty(result))
+ if (result.IsNotEmpty())
{
ParseOutput(result, out ulong up, out ulong down);
diff --git a/v2rayN/ServiceLib/Services/UpdateService.cs b/v2rayN/ServiceLib/Services/UpdateService.cs
index 6be2b3bf..9700f249 100644
--- a/v2rayN/ServiceLib/Services/UpdateService.cs
+++ b/v2rayN/ServiceLib/Services/UpdateService.cs
@@ -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) || (Utils.IsNotEmpty(subId) && item.Id != subId))
+ if (Utils.IsNullOrEmpty(id) || Utils.IsNullOrEmpty(url) || (subId.IsNotEmpty() && item.Id != subId))
{
//_updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgNoValidSubscription}");
continue;
@@ -149,7 +149,7 @@ namespace ServiceLib.Services
//one url
url = Utils.GetPunycode(url);
//convert
- if (Utils.IsNotEmpty(item.ConvertTarget))
+ if (item.ConvertTarget.IsNotEmpty())
{
var subConvertUrl = Utils.IsNullOrEmpty(config.ConstItem.SubConvertUrl) ? Global.SubConvertUrls.FirstOrDefault() : config.ConstItem.SubConvertUrl;
url = string.Format(subConvertUrl!, Utils.UrlEncode(url));
@@ -169,9 +169,9 @@ namespace ServiceLib.Services
}
//more url
- if (Utils.IsNullOrEmpty(item.ConvertTarget) && Utils.IsNotEmpty(item.MoreUrl.TrimEx()))
+ if (Utils.IsNullOrEmpty(item.ConvertTarget) && item.MoreUrl.TrimEx().IsNotEmpty())
{
- if (Utils.IsNotEmpty(result) && Utils.IsBase64String(result))
+ if (result.IsNotEmpty() && Utils.IsBase64String(result))
{
result = Utils.Base64Decode(result);
}
@@ -190,7 +190,7 @@ namespace ServiceLib.Services
{
result2 = await downloadHandle.TryDownloadString(url2, false, userAgent);
}
- if (Utils.IsNotEmpty(result2))
+ if (result2.IsNotEmpty())
{
if (Utils.IsBase64String(result2))
{
diff --git a/v2rayN/ServiceLib/ViewModels/AddServer2ViewModel.cs b/v2rayN/ServiceLib/ViewModels/AddServer2ViewModel.cs
index a37fa46e..aa796570 100644
--- a/v2rayN/ServiceLib/ViewModels/AddServer2ViewModel.cs
+++ b/v2rayN/ServiceLib/ViewModels/AddServer2ViewModel.cs
@@ -80,7 +80,7 @@ namespace ServiceLib.ViewModels
if (await ConfigHandler.AddCustomServer(_config, item, false) == 0)
{
NoticeHandler.Instance.Enqueue(ResUI.SuccessfullyImportedCustomServer);
- if (Utils.IsNotEmpty(item.IndexId))
+ if (item.IndexId.IsNotEmpty())
{
SelectedSource = JsonUtils.DeepCopy(item);
}
diff --git a/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs b/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs
index 166da0ee..9fd571a6 100644
--- a/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs
+++ b/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs
@@ -32,7 +32,7 @@ namespace ServiceLib.ViewModels
var canEditRemove = this.WhenAnyValue(
x => x.SelectedSource,
- selectedSource => selectedSource != null && Utils.IsNotEmpty(selectedSource.Id));
+ selectedSource => selectedSource != null && selectedSource.Id.IsNotEmpty());
this.WhenAnyValue(
x => x.AutoRefresh,
diff --git a/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs b/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs
index 5d8535c4..e5a2973a 100644
--- a/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs
+++ b/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs
@@ -72,7 +72,7 @@ namespace ServiceLib.ViewModels
this.WhenAnyValue(
x => x.SelectedGroup,
- y => y != null && Utils.IsNotEmpty(y.Name))
+ y => y != null && y.Name.IsNotEmpty())
.Subscribe(c => RefreshProxyDetails(c));
this.WhenAnyValue(
@@ -219,7 +219,7 @@ namespace ServiceLib.ViewModels
continue;
}
var item = _proxyGroups.Where(t => t.Name == kv.Key).FirstOrDefault();
- if (item != null && Utils.IsNotEmpty(item.Name))
+ if (item != null && item.Name.IsNotEmpty())
{
continue;
}
diff --git a/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs
index 9dbdba49..e88469d0 100644
--- a/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs
+++ b/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs
@@ -62,7 +62,7 @@ namespace ServiceLib.ViewModels
private async Task SaveSettingAsync()
{
- if (Utils.IsNotEmpty(normalDNS))
+ if (normalDNS.IsNotEmpty())
{
var obj = JsonUtils.ParseJson(normalDNS);
if (obj != null && obj["servers"] != null)
@@ -77,7 +77,7 @@ namespace ServiceLib.ViewModels
}
}
}
- if (Utils.IsNotEmpty(normalDNS2))
+ if (normalDNS2.IsNotEmpty())
{
var obj2 = JsonUtils.Deserialize(normalDNS2);
if (obj2 == null)
@@ -86,7 +86,7 @@ namespace ServiceLib.ViewModels
return;
}
}
- if (Utils.IsNotEmpty(tunDNS2))
+ if (tunDNS2.IsNotEmpty())
{
var obj2 = JsonUtils.Deserialize(tunDNS2);
if (obj2 == null)
diff --git a/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs b/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs
index 9405a42a..b25d840d 100644
--- a/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs
+++ b/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs
@@ -279,13 +279,13 @@ namespace ServiceLib.ViewModels
return;
}
- if (Utils.IsNotEmpty(result.Delay))
+ if (result.Delay.IsNotEmpty())
{
int.TryParse(result.Delay, out var temp);
item.Delay = temp;
item.DelayVal = result.Delay ?? string.Empty;
}
- if (Utils.IsNotEmpty(result.Speed))
+ if (result.Speed.IsNotEmpty())
{
item.SpeedVal = result.Speed ?? string.Empty;
}
diff --git a/v2rayN/ServiceLib/ViewModels/RoutingRuleDetailsViewModel.cs b/v2rayN/ServiceLib/ViewModels/RoutingRuleDetailsViewModel.cs
index 680be440..507336c9 100644
--- a/v2rayN/ServiceLib/ViewModels/RoutingRuleDetailsViewModel.cs
+++ b/v2rayN/ServiceLib/ViewModels/RoutingRuleDetailsViewModel.cs
@@ -78,8 +78,8 @@ namespace ServiceLib.ViewModels
|| SelectedSource.Ip?.Count > 0
|| SelectedSource.Protocol?.Count > 0
|| SelectedSource.Process?.Count > 0
- || Utils.IsNotEmpty(SelectedSource.Port)
- || Utils.IsNotEmpty(SelectedSource.Network);
+ || SelectedSource.Port.IsNotEmpty()
+ || SelectedSource.Network.IsNotEmpty();
if (!hasRule)
{
diff --git a/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs b/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs
index b2f134e1..455414b8 100644
--- a/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs
+++ b/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs
@@ -69,7 +69,7 @@ namespace v2rayN.Desktop.ViewModels
y => y != null && !y.IsNullOrEmpty())
.Subscribe(c =>
{
- if (Utils.IsNotEmpty(CurrentLanguage) && _config.UiItem.CurrentLanguage != CurrentLanguage)
+ if (CurrentLanguage.IsNotEmpty() && _config.UiItem.CurrentLanguage != CurrentLanguage)
{
_config.UiItem.CurrentLanguage = CurrentLanguage;
Thread.CurrentThread.CurrentUICulture = new(CurrentLanguage);
diff --git a/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs b/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs
index 20d9d5b5..4638c3ab 100644
--- a/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs
+++ b/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs
@@ -11,7 +11,7 @@ namespace v2rayN.Converters
try
{
var fontFamily = AppHandler.Instance.Config.UiItem.CurrentFontFamily;
- if (Utils.IsNotEmpty(fontFamily))
+ if (fontFamily.IsNotEmpty())
{
var fontPath = Utils.GetFontsPath();
MyFont = new FontFamily(new Uri(@$"file:///{fontPath}\"), $"./#{fontFamily}");
diff --git a/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs
index a9ce8589..fd075cb0 100644
--- a/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs
+++ b/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs
@@ -116,7 +116,7 @@ namespace v2rayN.ViewModels
y => y != null && !y.IsNullOrEmpty())
.Subscribe(c =>
{
- if (Utils.IsNotEmpty(CurrentLanguage) && _config.UiItem.CurrentLanguage != CurrentLanguage)
+ if (CurrentLanguage.IsNotEmpty() && _config.UiItem.CurrentLanguage != CurrentLanguage)
{
_config.UiItem.CurrentLanguage = CurrentLanguage;
Thread.CurrentThread.CurrentUICulture = new(CurrentLanguage);