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

This commit is contained in:
2dust
2025-03-05 16:42:43 +08:00
parent 78fde575d7
commit f3af831cf2
33 changed files with 128 additions and 133 deletions
@@ -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);
}
@@ -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,
@@ -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;
}
@@ -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<Dns4Sbox>(normalDNS2);
if (obj2 == null)
@@ -86,7 +86,7 @@ namespace ServiceLib.ViewModels
return;
}
}
if (Utils.IsNotEmpty(tunDNS2))
if (tunDNS2.IsNotEmpty())
{
var obj2 = JsonUtils.Deserialize<Dns4Sbox>(tunDNS2);
if (obj2 == null)
@@ -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;
}
@@ -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)
{