mirror of
https://github.com/2dust/v2rayN.git
synced 2025-05-03 13:48:52 +00:00
Add IsNotEmpty function
This commit is contained in:
parent
4c0a59a715
commit
61635db5b5
33 changed files with 140 additions and 135 deletions
|
@ -18,7 +18,7 @@ namespace ServiceLib.Common
|
||||||
Uri uri = new(url);
|
Uri uri = new(url);
|
||||||
//Authorization Header
|
//Authorization Header
|
||||||
var headers = new WebHeaderCollection();
|
var headers = new WebHeaderCollection();
|
||||||
if (!Utils.IsNullOrEmpty(uri.UserInfo))
|
if (Utils.IsNotEmpty(uri.UserInfo))
|
||||||
{
|
{
|
||||||
headers.Add(HttpRequestHeader.Authorization, "Basic " + Utils.Base64Encode(uri.UserInfo));
|
headers.Add(HttpRequestHeader.Authorization, "Basic " + Utils.Base64Encode(uri.UserInfo));
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace ServiceLib.Common
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(ignoredName) && entry.Name.Contains(ignoredName))
|
if (Utils.IsNotEmpty(ignoredName) && entry.Name.Contains(ignoredName))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ namespace ServiceLib.Common
|
||||||
// Get the files in the source directory and copy to the destination directory
|
// Get the files in the source directory and copy to the destination directory
|
||||||
foreach (FileInfo file in dir.GetFiles())
|
foreach (FileInfo file in dir.GetFiles())
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(ignoredName) && file.Name.Contains(ignoredName))
|
if (Utils.IsNotEmpty(ignoredName) && file.Name.Contains(ignoredName))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace ServiceLib.Common
|
||||||
|
|
||||||
public async Task<string?> TryGetAsync(string url)
|
public async Task<string?> TryGetAsync(string url)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(url))
|
if (Utils.IsNullOrEmpty(url))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -417,6 +417,11 @@ namespace ServiceLib.Common
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsNotEmpty(string? text)
|
||||||
|
{
|
||||||
|
return !string.IsNullOrEmpty(text);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 验证IP地址是否合法
|
/// 验证IP地址是否合法
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace ServiceLib.Handler
|
||||||
{
|
{
|
||||||
//载入配置文件
|
//载入配置文件
|
||||||
var result = Utils.LoadResource(Utils.GetConfigPath(configRes));
|
var result = Utils.LoadResource(Utils.GetConfigPath(configRes));
|
||||||
if (!Utils.IsNullOrEmpty(result))
|
if (Utils.IsNotEmpty(result))
|
||||||
{
|
{
|
||||||
//转成Json
|
//转成Json
|
||||||
config = JsonUtils.Deserialize<Config>(result);
|
config = JsonUtils.Deserialize<Config>(result);
|
||||||
|
@ -1007,7 +1007,7 @@ namespace ServiceLib.Handler
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(profileItem.security) && profileItem.security != Global.None)
|
if (Utils.IsNotEmpty(profileItem.security) && profileItem.security != Global.None)
|
||||||
{
|
{
|
||||||
profileItem.security = Global.None;
|
profileItem.security = Global.None;
|
||||||
}
|
}
|
||||||
|
@ -1045,7 +1045,7 @@ namespace ServiceLib.Handler
|
||||||
{
|
{
|
||||||
profileItem.configVersion = 2;
|
profileItem.configVersion = 2;
|
||||||
|
|
||||||
if (!Utils.IsNullOrEmpty(profileItem.streamSecurity))
|
if (Utils.IsNotEmpty(profileItem.streamSecurity))
|
||||||
{
|
{
|
||||||
if (profileItem.streamSecurity != Global.StreamSecurity
|
if (profileItem.streamSecurity != Global.StreamSecurity
|
||||||
&& profileItem.streamSecurity != Global.StreamSecurityReality)
|
&& profileItem.streamSecurity != Global.StreamSecurityReality)
|
||||||
|
@ -1065,7 +1065,7 @@ namespace ServiceLib.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Utils.IsNullOrEmpty(profileItem.network) && !Global.Networks.Contains(profileItem.network))
|
if (Utils.IsNotEmpty(profileItem.network) && !Global.Networks.Contains(profileItem.network))
|
||||||
{
|
{
|
||||||
profileItem.network = Global.DefaultNetwork;
|
profileItem.network = Global.DefaultNetwork;
|
||||||
}
|
}
|
||||||
|
@ -1186,7 +1186,7 @@ namespace ServiceLib.Handler
|
||||||
|
|
||||||
string subFilter = string.Empty;
|
string subFilter = string.Empty;
|
||||||
//remove sub items
|
//remove sub items
|
||||||
if (isSub && !Utils.IsNullOrEmpty(subid))
|
if (isSub && Utils.IsNotEmpty(subid))
|
||||||
{
|
{
|
||||||
RemoveServerViaSubid(config, subid, isSub);
|
RemoveServerViaSubid(config, subid, isSub);
|
||||||
subFilter = LazyConfig.Instance.GetSubItem(subid)?.filter ?? "";
|
subFilter = LazyConfig.Instance.GetSubItem(subid)?.filter ?? "";
|
||||||
|
@ -1219,7 +1219,7 @@ namespace ServiceLib.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
//exist sub items
|
//exist sub items
|
||||||
if (isSub && !Utils.IsNullOrEmpty(subid))
|
if (isSub && Utils.IsNotEmpty(subid))
|
||||||
{
|
{
|
||||||
var existItem = lstOriSub?.FirstOrDefault(t => t.isSub == isSub
|
var existItem = lstOriSub?.FirstOrDefault(t => t.isSub == isSub
|
||||||
&& config.uiItem.enableUpdateSubOnlyRemarksExist ? t.remarks == profileItem.remarks : CompareProfileItem(t, profileItem, true));
|
&& config.uiItem.enableUpdateSubOnlyRemarksExist ? t.remarks == profileItem.remarks : CompareProfileItem(t, profileItem, true));
|
||||||
|
@ -1241,7 +1241,7 @@ namespace ServiceLib.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//filter
|
//filter
|
||||||
if (!Utils.IsNullOrEmpty(subFilter))
|
if (Utils.IsNotEmpty(subFilter))
|
||||||
{
|
{
|
||||||
if (!Regex.IsMatch(profileItem.remarks, subFilter))
|
if (!Regex.IsMatch(profileItem.remarks, subFilter))
|
||||||
{
|
{
|
||||||
|
@ -1305,7 +1305,7 @@ namespace ServiceLib.Handler
|
||||||
}
|
}
|
||||||
if (lstProfiles != null && lstProfiles.Count > 0)
|
if (lstProfiles != null && lstProfiles.Count > 0)
|
||||||
{
|
{
|
||||||
if (isSub && !Utils.IsNullOrEmpty(subid))
|
if (isSub && Utils.IsNotEmpty(subid))
|
||||||
{
|
{
|
||||||
RemoveServerViaSubid(config, subid, isSub);
|
RemoveServerViaSubid(config, subid, isSub);
|
||||||
}
|
}
|
||||||
|
@ -1361,7 +1361,7 @@ namespace ServiceLib.Handler
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSub && !Utils.IsNullOrEmpty(subid))
|
if (isSub && Utils.IsNotEmpty(subid))
|
||||||
{
|
{
|
||||||
RemoveServerViaSubid(config, subid, isSub);
|
RemoveServerViaSubid(config, subid, isSub);
|
||||||
}
|
}
|
||||||
|
@ -1389,7 +1389,7 @@ namespace ServiceLib.Handler
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSub && !Utils.IsNullOrEmpty(subid))
|
if (isSub && Utils.IsNotEmpty(subid))
|
||||||
{
|
{
|
||||||
RemoveServerViaSubid(config, subid, isSub);
|
RemoveServerViaSubid(config, subid, isSub);
|
||||||
}
|
}
|
||||||
|
@ -1421,7 +1421,7 @@ namespace ServiceLib.Handler
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
List<ProfileItem>? lstOriSub = null;
|
List<ProfileItem>? lstOriSub = null;
|
||||||
if (isSub && !Utils.IsNullOrEmpty(subid))
|
if (isSub && Utils.IsNotEmpty(subid))
|
||||||
{
|
{
|
||||||
lstOriSub = LazyConfig.Instance.ProfileItems(subid);
|
lstOriSub = LazyConfig.Instance.ProfileItems(subid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
string addressFileName = node.address;
|
string addressFileName = node.address;
|
||||||
if (string.IsNullOrEmpty(addressFileName))
|
if (Utils.IsNullOrEmpty(addressFileName))
|
||||||
{
|
{
|
||||||
msg = ResUI.FailedGetDefaultConfiguration;
|
msg = ResUI.FailedGetDefaultConfiguration;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -117,7 +117,7 @@
|
||||||
if (_config.tunModeItem.enableTun)
|
if (_config.tunModeItem.enableTun)
|
||||||
{
|
{
|
||||||
string tun = Utils.GetEmbedText(Global.ClashTunYaml);
|
string tun = Utils.GetEmbedText(Global.ClashTunYaml);
|
||||||
if (!string.IsNullOrEmpty(tun))
|
if (Utils.IsNotEmpty(tun))
|
||||||
{
|
{
|
||||||
var tunContent = YamlUtils.FromYaml<Dictionary<string, object>>(tun);
|
var tunContent = YamlUtils.FromYaml<Dictionary<string, object>>(tun);
|
||||||
if (tunContent != null)
|
if (tunContent != null)
|
||||||
|
|
|
@ -370,7 +370,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
string addressFileName = node.address;
|
string addressFileName = node.address;
|
||||||
if (string.IsNullOrEmpty(addressFileName))
|
if (Utils.IsNullOrEmpty(addressFileName))
|
||||||
{
|
{
|
||||||
msg = ResUI.FailedGetDefaultConfiguration;
|
msg = ResUI.FailedGetDefaultConfiguration;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -489,7 +489,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
if (_config.routingBasicItem.enableRoutingAdvanced)
|
if (_config.routingBasicItem.enableRoutingAdvanced)
|
||||||
{
|
{
|
||||||
var routing = ConfigHandler.GetDefaultRouting(_config);
|
var routing = ConfigHandler.GetDefaultRouting(_config);
|
||||||
if (!Utils.IsNullOrEmpty(routing.domainStrategy4Singbox))
|
if (Utils.IsNotEmpty(routing.domainStrategy4Singbox))
|
||||||
{
|
{
|
||||||
inbound.domain_strategy = routing.domainStrategy4Singbox;
|
inbound.domain_strategy = routing.domainStrategy4Singbox;
|
||||||
}
|
}
|
||||||
|
@ -512,7 +512,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
singboxConfig.inbounds.Add(inbound4);
|
singboxConfig.inbounds.Add(inbound4);
|
||||||
|
|
||||||
//auth
|
//auth
|
||||||
if (!Utils.IsNullOrEmpty(_config.inbound[0].user) && !Utils.IsNullOrEmpty(_config.inbound[0].pass))
|
if (Utils.IsNotEmpty(_config.inbound[0].user) && Utils.IsNotEmpty(_config.inbound[0].pass))
|
||||||
{
|
{
|
||||||
inbound3.users = new() { new() { username = _config.inbound[0].user, password = _config.inbound[0].pass } };
|
inbound3.users = new() { new() { username = _config.inbound[0].user, password = _config.inbound[0].pass } };
|
||||||
inbound4.users = new() { new() { username = _config.inbound[0].user, password = _config.inbound[0].pass } };
|
inbound4.users = new() { new() { username = _config.inbound[0].user, password = _config.inbound[0].pass } };
|
||||||
|
@ -604,8 +604,8 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
case EConfigType.Socks:
|
case EConfigType.Socks:
|
||||||
{
|
{
|
||||||
outbound.version = "5";
|
outbound.version = "5";
|
||||||
if (!Utils.IsNullOrEmpty(node.security)
|
if (Utils.IsNotEmpty(node.security)
|
||||||
&& !Utils.IsNullOrEmpty(node.id))
|
&& Utils.IsNotEmpty(node.id))
|
||||||
{
|
{
|
||||||
outbound.username = node.security;
|
outbound.username = node.security;
|
||||||
outbound.password = node.id;
|
outbound.password = node.id;
|
||||||
|
@ -614,8 +614,8 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
}
|
}
|
||||||
case EConfigType.Http:
|
case EConfigType.Http:
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(node.security)
|
if (Utils.IsNotEmpty(node.security)
|
||||||
&& !Utils.IsNullOrEmpty(node.id))
|
&& Utils.IsNotEmpty(node.id))
|
||||||
{
|
{
|
||||||
outbound.username = node.security;
|
outbound.username = node.security;
|
||||||
outbound.password = node.id;
|
outbound.password = node.id;
|
||||||
|
@ -649,7 +649,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
{
|
{
|
||||||
outbound.password = node.id;
|
outbound.password = node.id;
|
||||||
|
|
||||||
if (!Utils.IsNullOrEmpty(node.path))
|
if (Utils.IsNotEmpty(node.path))
|
||||||
{
|
{
|
||||||
outbound.obfs = new()
|
outbound.obfs = new()
|
||||||
{
|
{
|
||||||
|
@ -695,7 +695,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_config.coreBasicItem.muxEnabled && !Utils.IsNullOrEmpty(_config.mux4SboxItem.protocol))
|
if (_config.coreBasicItem.muxEnabled && Utils.IsNotEmpty(_config.mux4SboxItem.protocol))
|
||||||
{
|
{
|
||||||
var mux = new Multiplex4Sbox()
|
var mux = new Multiplex4Sbox()
|
||||||
{
|
{
|
||||||
|
@ -721,11 +721,11 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
if (node.streamSecurity == Global.StreamSecurityReality || node.streamSecurity == Global.StreamSecurity)
|
if (node.streamSecurity == Global.StreamSecurityReality || node.streamSecurity == Global.StreamSecurity)
|
||||||
{
|
{
|
||||||
var server_name = string.Empty;
|
var server_name = string.Empty;
|
||||||
if (!Utils.IsNullOrEmpty(node.sni))
|
if (Utils.IsNotEmpty(node.sni))
|
||||||
{
|
{
|
||||||
server_name = node.sni;
|
server_name = node.sni;
|
||||||
}
|
}
|
||||||
else if (!Utils.IsNullOrEmpty(node.requestHost))
|
else if (Utils.IsNotEmpty(node.requestHost))
|
||||||
{
|
{
|
||||||
server_name = Utils.String2List(node.requestHost)[0];
|
server_name = Utils.String2List(node.requestHost)[0];
|
||||||
}
|
}
|
||||||
|
@ -736,7 +736,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
insecure = Utils.ToBool(node.allowInsecure.IsNullOrEmpty() ? _config.coreBasicItem.defAllowInsecure.ToString().ToLower() : node.allowInsecure),
|
insecure = Utils.ToBool(node.allowInsecure.IsNullOrEmpty() ? _config.coreBasicItem.defAllowInsecure.ToString().ToLower() : node.allowInsecure),
|
||||||
alpn = node.GetAlpn(),
|
alpn = node.GetAlpn(),
|
||||||
};
|
};
|
||||||
if (!Utils.IsNullOrEmpty(node.fingerprint))
|
if (Utils.IsNotEmpty(node.fingerprint))
|
||||||
{
|
{
|
||||||
tls.utls = new Utls4Sbox()
|
tls.utls = new Utls4Sbox()
|
||||||
{
|
{
|
||||||
|
@ -798,7 +798,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
case nameof(ETransport.ws):
|
case nameof(ETransport.ws):
|
||||||
transport.type = nameof(ETransport.ws);
|
transport.type = nameof(ETransport.ws);
|
||||||
transport.path = Utils.IsNullOrEmpty(node.path) ? null : node.path;
|
transport.path = Utils.IsNullOrEmpty(node.path) ? null : node.path;
|
||||||
if (!Utils.IsNullOrEmpty(node.requestHost))
|
if (Utils.IsNotEmpty(node.requestHost))
|
||||||
{
|
{
|
||||||
transport.headers = new()
|
transport.headers = new()
|
||||||
{
|
{
|
||||||
|
@ -1020,7 +1020,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
outbound = item.outboundTag,
|
outbound = item.outboundTag,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!Utils.IsNullOrEmpty(item.port))
|
if (Utils.IsNotEmpty(item.port))
|
||||||
{
|
{
|
||||||
if (item.port.Contains("-"))
|
if (item.port.Contains("-"))
|
||||||
{
|
{
|
||||||
|
@ -1031,7 +1031,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
rule.port = new List<int> { Utils.ToInt(item.port) };
|
rule.port = new List<int> { Utils.ToInt(item.port) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(item.network))
|
if (Utils.IsNotEmpty(item.network))
|
||||||
{
|
{
|
||||||
rule.network = Utils.String2List(item.network);
|
rule.network = Utils.String2List(item.network);
|
||||||
}
|
}
|
||||||
|
@ -1221,7 +1221,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
});
|
});
|
||||||
|
|
||||||
var lstDomain = singboxConfig.outbounds
|
var lstDomain = singboxConfig.outbounds
|
||||||
.Where(t => !Utils.IsNullOrEmpty(t.server) && Utils.IsDomain(t.server))
|
.Where(t => Utils.IsNotEmpty(t.server) && Utils.IsDomain(t.server))
|
||||||
.Select(t => t.server)
|
.Select(t => t.server)
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -1324,10 +1324,10 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
if (_config.routingBasicItem.enableRoutingAdvanced)
|
if (_config.routingBasicItem.enableRoutingAdvanced)
|
||||||
{
|
{
|
||||||
var routing = ConfigHandler.GetDefaultRouting(_config);
|
var routing = ConfigHandler.GetDefaultRouting(_config);
|
||||||
if (!Utils.IsNullOrEmpty(routing.customRulesetPath4Singbox))
|
if (Utils.IsNotEmpty(routing.customRulesetPath4Singbox))
|
||||||
{
|
{
|
||||||
var result = Utils.LoadResource(routing.customRulesetPath4Singbox);
|
var result = Utils.LoadResource(routing.customRulesetPath4Singbox);
|
||||||
if (!Utils.IsNullOrEmpty(result))
|
if (Utils.IsNotEmpty(result))
|
||||||
{
|
{
|
||||||
customRulesets = (JsonUtils.Deserialize<List<Ruleset4Sbox>>(result) ?? [])
|
customRulesets = (JsonUtils.Deserialize<List<Ruleset4Sbox>>(result) ?? [])
|
||||||
.Where(t => t.tag != null)
|
.Where(t => t.tag != null)
|
||||||
|
|
|
@ -392,7 +392,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
v2rayConfig.inbounds.Add(inbound4);
|
v2rayConfig.inbounds.Add(inbound4);
|
||||||
|
|
||||||
//auth
|
//auth
|
||||||
if (!Utils.IsNullOrEmpty(_config.inbound[0].user) && !Utils.IsNullOrEmpty(_config.inbound[0].pass))
|
if (Utils.IsNotEmpty(_config.inbound[0].user) && Utils.IsNotEmpty(_config.inbound[0].pass))
|
||||||
{
|
{
|
||||||
inbound3.settings.auth = "password";
|
inbound3.settings.auth = "password";
|
||||||
inbound3.settings.accounts = new List<AccountsItem4Ray> { new AccountsItem4Ray() { user = _config.inbound[0].user, pass = _config.inbound[0].pass } };
|
inbound3.settings.accounts = new List<AccountsItem4Ray> { new AccountsItem4Ray() { user = _config.inbound[0].user, pass = _config.inbound[0].pass } };
|
||||||
|
@ -453,7 +453,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
var routing = ConfigHandler.GetDefaultRouting(_config);
|
var routing = ConfigHandler.GetDefaultRouting(_config);
|
||||||
if (routing != null)
|
if (routing != null)
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(routing.domainStrategy))
|
if (Utils.IsNotEmpty(routing.domainStrategy))
|
||||||
{
|
{
|
||||||
v2rayConfig.routing.domainStrategy = routing.domainStrategy;
|
v2rayConfig.routing.domainStrategy = routing.domainStrategy;
|
||||||
}
|
}
|
||||||
|
@ -550,7 +550,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
}
|
}
|
||||||
if (!hasDomainIp)
|
if (!hasDomainIp)
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(rule.port)
|
if (Utils.IsNotEmpty(rule.port)
|
||||||
|| rule.protocol?.Count > 0
|
|| rule.protocol?.Count > 0
|
||||||
|| rule.inboundTag?.Count > 0
|
|| rule.inboundTag?.Count > 0
|
||||||
)
|
)
|
||||||
|
@ -660,8 +660,8 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
serversItem.method = null;
|
serversItem.method = null;
|
||||||
serversItem.password = null;
|
serversItem.password = null;
|
||||||
|
|
||||||
if (!Utils.IsNullOrEmpty(node.security)
|
if (Utils.IsNotEmpty(node.security)
|
||||||
&& !Utils.IsNullOrEmpty(node.id))
|
&& Utils.IsNotEmpty(node.id))
|
||||||
{
|
{
|
||||||
SocksUsersItem4Ray socksUsersItem = new()
|
SocksUsersItem4Ray socksUsersItem = new()
|
||||||
{
|
{
|
||||||
|
@ -712,7 +712,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
if (node.streamSecurity == Global.StreamSecurityReality
|
if (node.streamSecurity == Global.StreamSecurityReality
|
||||||
|| node.streamSecurity == Global.StreamSecurity)
|
|| node.streamSecurity == Global.StreamSecurity)
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(node.flow))
|
if (Utils.IsNotEmpty(node.flow))
|
||||||
{
|
{
|
||||||
usersItem.flow = node.flow;
|
usersItem.flow = node.flow;
|
||||||
|
|
||||||
|
@ -818,11 +818,11 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
alpn = node.GetAlpn(),
|
alpn = node.GetAlpn(),
|
||||||
fingerprint = node.fingerprint.IsNullOrEmpty() ? _config.coreBasicItem.defFingerprint : node.fingerprint
|
fingerprint = node.fingerprint.IsNullOrEmpty() ? _config.coreBasicItem.defFingerprint : node.fingerprint
|
||||||
};
|
};
|
||||||
if (!Utils.IsNullOrEmpty(sni))
|
if (Utils.IsNotEmpty(sni))
|
||||||
{
|
{
|
||||||
tlsSettings.serverName = sni;
|
tlsSettings.serverName = sni;
|
||||||
}
|
}
|
||||||
else if (!Utils.IsNullOrEmpty(host))
|
else if (Utils.IsNotEmpty(host))
|
||||||
{
|
{
|
||||||
tlsSettings.serverName = Utils.String2List(host)[0];
|
tlsSettings.serverName = Utils.String2List(host)[0];
|
||||||
}
|
}
|
||||||
|
@ -867,7 +867,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
{
|
{
|
||||||
type = node.headerType
|
type = node.headerType
|
||||||
};
|
};
|
||||||
if (!Utils.IsNullOrEmpty(node.path))
|
if (Utils.IsNotEmpty(node.path))
|
||||||
{
|
{
|
||||||
kcpSettings.seed = node.path;
|
kcpSettings.seed = node.path;
|
||||||
}
|
}
|
||||||
|
@ -878,15 +878,15 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
WsSettings4Ray wsSettings = new();
|
WsSettings4Ray wsSettings = new();
|
||||||
wsSettings.headers = new Headers4Ray();
|
wsSettings.headers = new Headers4Ray();
|
||||||
string path = node.path;
|
string path = node.path;
|
||||||
if (!Utils.IsNullOrEmpty(host))
|
if (Utils.IsNotEmpty(host))
|
||||||
{
|
{
|
||||||
wsSettings.headers.Host = host;
|
wsSettings.headers.Host = host;
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(path))
|
if (Utils.IsNotEmpty(path))
|
||||||
{
|
{
|
||||||
wsSettings.path = path;
|
wsSettings.path = path;
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(useragent))
|
if (Utils.IsNotEmpty(useragent))
|
||||||
{
|
{
|
||||||
wsSettings.headers.UserAgent = useragent;
|
wsSettings.headers.UserAgent = useragent;
|
||||||
}
|
}
|
||||||
|
@ -897,11 +897,11 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
case nameof(ETransport.httpupgrade):
|
case nameof(ETransport.httpupgrade):
|
||||||
HttpupgradeSettings4Ray httpupgradeSettings = new();
|
HttpupgradeSettings4Ray httpupgradeSettings = new();
|
||||||
|
|
||||||
if (!Utils.IsNullOrEmpty(node.path))
|
if (Utils.IsNotEmpty(node.path))
|
||||||
{
|
{
|
||||||
httpupgradeSettings.path = node.path;
|
httpupgradeSettings.path = node.path;
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(host))
|
if (Utils.IsNotEmpty(host))
|
||||||
{
|
{
|
||||||
httpupgradeSettings.host = host;
|
httpupgradeSettings.host = host;
|
||||||
}
|
}
|
||||||
|
@ -916,11 +916,11 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
maxConcurrentUploads = 10
|
maxConcurrentUploads = 10
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!Utils.IsNullOrEmpty(node.path))
|
if (Utils.IsNotEmpty(node.path))
|
||||||
{
|
{
|
||||||
splithttpSettings.path = node.path;
|
splithttpSettings.path = node.path;
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(host))
|
if (Utils.IsNotEmpty(host))
|
||||||
{
|
{
|
||||||
splithttpSettings.host = host;
|
splithttpSettings.host = host;
|
||||||
}
|
}
|
||||||
|
@ -931,7 +931,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
case nameof(ETransport.h2):
|
case nameof(ETransport.h2):
|
||||||
HttpSettings4Ray httpSettings = new();
|
HttpSettings4Ray httpSettings = new();
|
||||||
|
|
||||||
if (!Utils.IsNullOrEmpty(host))
|
if (Utils.IsNotEmpty(host))
|
||||||
{
|
{
|
||||||
httpSettings.host = Utils.String2List(host);
|
httpSettings.host = Utils.String2List(host);
|
||||||
}
|
}
|
||||||
|
@ -954,7 +954,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
streamSettings.quicSettings = quicsettings;
|
streamSettings.quicSettings = quicsettings;
|
||||||
if (node.streamSecurity == Global.StreamSecurity)
|
if (node.streamSecurity == Global.StreamSecurity)
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(sni))
|
if (Utils.IsNotEmpty(sni))
|
||||||
{
|
{
|
||||||
streamSettings.tlsSettings.serverName = sni;
|
streamSettings.tlsSettings.serverName = sni;
|
||||||
}
|
}
|
||||||
|
@ -1000,7 +1000,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
request = request.Replace("$requestUserAgent$", $"\"{useragent}\"");
|
request = request.Replace("$requestUserAgent$", $"\"{useragent}\"");
|
||||||
//Path
|
//Path
|
||||||
string pathHttp = @"/";
|
string pathHttp = @"/";
|
||||||
if (!Utils.IsNullOrEmpty(node.path))
|
if (Utils.IsNotEmpty(node.path))
|
||||||
{
|
{
|
||||||
string[] arrPath = node.path.Split(',');
|
string[] arrPath = node.path.Split(',');
|
||||||
pathHttp = string.Join("\",\"", arrPath);
|
pathHttp = string.Join("\",\"", arrPath);
|
||||||
|
@ -1033,7 +1033,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
//Outbound Freedom domainStrategy
|
//Outbound Freedom domainStrategy
|
||||||
if (!Utils.IsNullOrEmpty(domainStrategy4Freedom))
|
if (Utils.IsNotEmpty(domainStrategy4Freedom))
|
||||||
{
|
{
|
||||||
var outbound = v2rayConfig.outbounds[1];
|
var outbound = v2rayConfig.outbounds[1];
|
||||||
outbound.settings.domainStrategy = domainStrategy4Freedom;
|
outbound.settings.domainStrategy = domainStrategy4Freedom;
|
||||||
|
@ -1157,7 +1157,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
{
|
{
|
||||||
//fragment proxy
|
//fragment proxy
|
||||||
if (_config.coreBasicItem.enableFragment
|
if (_config.coreBasicItem.enableFragment
|
||||||
&& !Utils.IsNullOrEmpty(v2rayConfig.outbounds[0].streamSettings?.security))
|
&& Utils.IsNotEmpty(v2rayConfig.outbounds[0].streamSettings?.security))
|
||||||
{
|
{
|
||||||
var fragmentOutbound = new Outbounds4Ray
|
var fragmentOutbound = new Outbounds4Ray
|
||||||
{
|
{
|
||||||
|
|
|
@ -302,7 +302,7 @@ namespace ServiceLib.Handler
|
||||||
{
|
{
|
||||||
proc.OutputDataReceived += (sender, e) =>
|
proc.OutputDataReceived += (sender, e) =>
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(e.Data))
|
if (Utils.IsNotEmpty(e.Data))
|
||||||
{
|
{
|
||||||
string msg = e.Data + Environment.NewLine;
|
string msg = e.Data + Environment.NewLine;
|
||||||
ShowMsg(false, msg);
|
ShowMsg(false, msg);
|
||||||
|
@ -310,7 +310,7 @@ namespace ServiceLib.Handler
|
||||||
};
|
};
|
||||||
proc.ErrorDataReceived += (sender, e) =>
|
proc.ErrorDataReceived += (sender, e) =>
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(e.Data))
|
if (Utils.IsNotEmpty(e.Data))
|
||||||
{
|
{
|
||||||
string msg = e.Data + Environment.NewLine;
|
string msg = e.Data + Environment.NewLine;
|
||||||
ShowMsg(false, msg);
|
ShowMsg(false, msg);
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace ServiceLib.Handler
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result1 = await DownloadStringAsync(url, blProxy, userAgent);
|
var result1 = await DownloadStringAsync(url, blProxy, userAgent);
|
||||||
if (!Utils.IsNullOrEmpty(result1))
|
if (Utils.IsNotEmpty(result1))
|
||||||
{
|
{
|
||||||
return result1;
|
return result1;
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ namespace ServiceLib.Handler
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result2 = await DownloadStringViaDownloader(url, blProxy, userAgent);
|
var result2 = await DownloadStringViaDownloader(url, blProxy, userAgent);
|
||||||
if (!Utils.IsNullOrEmpty(result2))
|
if (Utils.IsNotEmpty(result2))
|
||||||
{
|
{
|
||||||
return result2;
|
return result2;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ namespace ServiceLib.Handler
|
||||||
using var wc = new WebClient();
|
using var wc = new WebClient();
|
||||||
wc.Proxy = GetWebProxy(blProxy);
|
wc.Proxy = GetWebProxy(blProxy);
|
||||||
var result3 = await wc.DownloadStringTaskAsync(url);
|
var result3 = await wc.DownloadStringTaskAsync(url);
|
||||||
if (!Utils.IsNullOrEmpty(result3))
|
if (Utils.IsNotEmpty(result3))
|
||||||
{
|
{
|
||||||
return result3;
|
return result3;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ namespace ServiceLib.Handler
|
||||||
|
|
||||||
Uri uri = new(url);
|
Uri uri = new(url);
|
||||||
//Authorization Header
|
//Authorization Header
|
||||||
if (!Utils.IsNullOrEmpty(uri.UserInfo))
|
if (Utils.IsNotEmpty(uri.UserInfo))
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Utils.Base64Encode(uri.UserInfo));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Utils.Base64Encode(uri.UserInfo));
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,12 @@ namespace ServiceLib.Handler.Fmt
|
||||||
|
|
||||||
protected static int GetStdTransport(ProfileItem item, string? securityDef, ref Dictionary<string, string> dicQuery)
|
protected static int GetStdTransport(ProfileItem item, string? securityDef, ref Dictionary<string, string> dicQuery)
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(item.flow))
|
if (Utils.IsNotEmpty(item.flow))
|
||||||
{
|
{
|
||||||
dicQuery.Add("flow", item.flow);
|
dicQuery.Add("flow", item.flow);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Utils.IsNullOrEmpty(item.streamSecurity))
|
if (Utils.IsNotEmpty(item.streamSecurity))
|
||||||
{
|
{
|
||||||
dicQuery.Add("security", item.streamSecurity);
|
dicQuery.Add("security", item.streamSecurity);
|
||||||
}
|
}
|
||||||
|
@ -32,27 +32,27 @@ namespace ServiceLib.Handler.Fmt
|
||||||
dicQuery.Add("security", securityDef);
|
dicQuery.Add("security", securityDef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(item.sni))
|
if (Utils.IsNotEmpty(item.sni))
|
||||||
{
|
{
|
||||||
dicQuery.Add("sni", item.sni);
|
dicQuery.Add("sni", item.sni);
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(item.alpn))
|
if (Utils.IsNotEmpty(item.alpn))
|
||||||
{
|
{
|
||||||
dicQuery.Add("alpn", Utils.UrlEncode(item.alpn));
|
dicQuery.Add("alpn", Utils.UrlEncode(item.alpn));
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(item.fingerprint))
|
if (Utils.IsNotEmpty(item.fingerprint))
|
||||||
{
|
{
|
||||||
dicQuery.Add("fp", Utils.UrlEncode(item.fingerprint));
|
dicQuery.Add("fp", Utils.UrlEncode(item.fingerprint));
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(item.publicKey))
|
if (Utils.IsNotEmpty(item.publicKey))
|
||||||
{
|
{
|
||||||
dicQuery.Add("pbk", Utils.UrlEncode(item.publicKey));
|
dicQuery.Add("pbk", Utils.UrlEncode(item.publicKey));
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(item.shortId))
|
if (Utils.IsNotEmpty(item.shortId))
|
||||||
{
|
{
|
||||||
dicQuery.Add("sid", Utils.UrlEncode(item.shortId));
|
dicQuery.Add("sid", Utils.UrlEncode(item.shortId));
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(item.spiderX))
|
if (Utils.IsNotEmpty(item.spiderX))
|
||||||
{
|
{
|
||||||
dicQuery.Add("spx", Utils.UrlEncode(item.spiderX));
|
dicQuery.Add("spx", Utils.UrlEncode(item.spiderX));
|
||||||
}
|
}
|
||||||
|
@ -61,21 +61,21 @@ namespace ServiceLib.Handler.Fmt
|
||||||
dicQuery.Add("allowInsecure", "1");
|
dicQuery.Add("allowInsecure", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
dicQuery.Add("type", !Utils.IsNullOrEmpty(item.network) ? item.network : nameof(ETransport.tcp));
|
dicQuery.Add("type", Utils.IsNotEmpty(item.network) ? item.network : nameof(ETransport.tcp));
|
||||||
|
|
||||||
switch (item.network)
|
switch (item.network)
|
||||||
{
|
{
|
||||||
case nameof(ETransport.tcp):
|
case nameof(ETransport.tcp):
|
||||||
dicQuery.Add("headerType", !Utils.IsNullOrEmpty(item.headerType) ? item.headerType : Global.None);
|
dicQuery.Add("headerType", Utils.IsNotEmpty(item.headerType) ? item.headerType : Global.None);
|
||||||
if (!Utils.IsNullOrEmpty(item.requestHost))
|
if (Utils.IsNotEmpty(item.requestHost))
|
||||||
{
|
{
|
||||||
dicQuery.Add("host", Utils.UrlEncode(item.requestHost));
|
dicQuery.Add("host", Utils.UrlEncode(item.requestHost));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nameof(ETransport.kcp):
|
case nameof(ETransport.kcp):
|
||||||
dicQuery.Add("headerType", !Utils.IsNullOrEmpty(item.headerType) ? item.headerType : Global.None);
|
dicQuery.Add("headerType", Utils.IsNotEmpty(item.headerType) ? item.headerType : Global.None);
|
||||||
if (!Utils.IsNullOrEmpty(item.path))
|
if (Utils.IsNotEmpty(item.path))
|
||||||
{
|
{
|
||||||
dicQuery.Add("seed", Utils.UrlEncode(item.path));
|
dicQuery.Add("seed", Utils.UrlEncode(item.path));
|
||||||
}
|
}
|
||||||
|
@ -84,11 +84,11 @@ namespace ServiceLib.Handler.Fmt
|
||||||
case nameof(ETransport.ws):
|
case nameof(ETransport.ws):
|
||||||
case nameof(ETransport.httpupgrade):
|
case nameof(ETransport.httpupgrade):
|
||||||
case nameof(ETransport.splithttp):
|
case nameof(ETransport.splithttp):
|
||||||
if (!Utils.IsNullOrEmpty(item.requestHost))
|
if (Utils.IsNotEmpty(item.requestHost))
|
||||||
{
|
{
|
||||||
dicQuery.Add("host", Utils.UrlEncode(item.requestHost));
|
dicQuery.Add("host", Utils.UrlEncode(item.requestHost));
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(item.path))
|
if (Utils.IsNotEmpty(item.path))
|
||||||
{
|
{
|
||||||
dicQuery.Add("path", Utils.UrlEncode(item.path));
|
dicQuery.Add("path", Utils.UrlEncode(item.path));
|
||||||
}
|
}
|
||||||
|
@ -97,24 +97,24 @@ namespace ServiceLib.Handler.Fmt
|
||||||
case nameof(ETransport.http):
|
case nameof(ETransport.http):
|
||||||
case nameof(ETransport.h2):
|
case nameof(ETransport.h2):
|
||||||
dicQuery["type"] = nameof(ETransport.http);
|
dicQuery["type"] = nameof(ETransport.http);
|
||||||
if (!Utils.IsNullOrEmpty(item.requestHost))
|
if (Utils.IsNotEmpty(item.requestHost))
|
||||||
{
|
{
|
||||||
dicQuery.Add("host", Utils.UrlEncode(item.requestHost));
|
dicQuery.Add("host", Utils.UrlEncode(item.requestHost));
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(item.path))
|
if (Utils.IsNotEmpty(item.path))
|
||||||
{
|
{
|
||||||
dicQuery.Add("path", Utils.UrlEncode(item.path));
|
dicQuery.Add("path", Utils.UrlEncode(item.path));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nameof(ETransport.quic):
|
case nameof(ETransport.quic):
|
||||||
dicQuery.Add("headerType", !Utils.IsNullOrEmpty(item.headerType) ? item.headerType : Global.None);
|
dicQuery.Add("headerType", Utils.IsNotEmpty(item.headerType) ? item.headerType : Global.None);
|
||||||
dicQuery.Add("quicSecurity", Utils.UrlEncode(item.requestHost));
|
dicQuery.Add("quicSecurity", Utils.UrlEncode(item.requestHost));
|
||||||
dicQuery.Add("key", Utils.UrlEncode(item.path));
|
dicQuery.Add("key", Utils.UrlEncode(item.path));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nameof(ETransport.grpc):
|
case nameof(ETransport.grpc):
|
||||||
if (!Utils.IsNullOrEmpty(item.path))
|
if (Utils.IsNotEmpty(item.path))
|
||||||
{
|
{
|
||||||
dicQuery.Add("authority", Utils.UrlEncode(item.requestHost));
|
dicQuery.Add("authority", Utils.UrlEncode(item.requestHost));
|
||||||
dicQuery.Add("serviceName", Utils.UrlEncode(item.path));
|
dicQuery.Add("serviceName", Utils.UrlEncode(item.path));
|
||||||
|
|
|
@ -31,20 +31,20 @@
|
||||||
string url = string.Empty;
|
string url = string.Empty;
|
||||||
|
|
||||||
string remark = string.Empty;
|
string remark = string.Empty;
|
||||||
if (!Utils.IsNullOrEmpty(item.remarks))
|
if (Utils.IsNotEmpty(item.remarks))
|
||||||
{
|
{
|
||||||
remark = "#" + Utils.UrlEncode(item.remarks);
|
remark = "#" + Utils.UrlEncode(item.remarks);
|
||||||
}
|
}
|
||||||
var dicQuery = new Dictionary<string, string>();
|
var dicQuery = new Dictionary<string, string>();
|
||||||
if (!Utils.IsNullOrEmpty(item.sni))
|
if (Utils.IsNotEmpty(item.sni))
|
||||||
{
|
{
|
||||||
dicQuery.Add("sni", item.sni);
|
dicQuery.Add("sni", item.sni);
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(item.alpn))
|
if (Utils.IsNotEmpty(item.alpn))
|
||||||
{
|
{
|
||||||
dicQuery.Add("alpn", Utils.UrlEncode(item.alpn));
|
dicQuery.Add("alpn", Utils.UrlEncode(item.alpn));
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(item.path))
|
if (Utils.IsNotEmpty(item.path))
|
||||||
{
|
{
|
||||||
dicQuery.Add("obfs", "salamander");
|
dicQuery.Add("obfs", "salamander");
|
||||||
dicQuery.Add("obfs-password", Utils.UrlEncode(item.path));
|
dicQuery.Add("obfs-password", Utils.UrlEncode(item.path));
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace ServiceLib.Handler.Fmt
|
||||||
string url = string.Empty;
|
string url = string.Empty;
|
||||||
|
|
||||||
string remark = string.Empty;
|
string remark = string.Empty;
|
||||||
if (!Utils.IsNullOrEmpty(item.remarks))
|
if (Utils.IsNotEmpty(item.remarks))
|
||||||
{
|
{
|
||||||
remark = "#" + Utils.UrlEncode(item.remarks);
|
remark = "#" + Utils.UrlEncode(item.remarks);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ namespace ServiceLib.Handler.Fmt
|
||||||
ProfileItem item = new();
|
ProfileItem item = new();
|
||||||
var base64 = match.Groups["base64"].Value.TrimEnd('/');
|
var base64 = match.Groups["base64"].Value.TrimEnd('/');
|
||||||
var tag = match.Groups["tag"].Value;
|
var tag = match.Groups["tag"].Value;
|
||||||
if (!Utils.IsNullOrEmpty(tag))
|
if (Utils.IsNotEmpty(tag))
|
||||||
{
|
{
|
||||||
item.remarks = Utils.UrlDecode(tag);
|
item.remarks = Utils.UrlDecode(tag);
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ namespace ServiceLib.Handler.Fmt
|
||||||
{
|
{
|
||||||
//obfs-host exists
|
//obfs-host exists
|
||||||
var obfsHost = queryParameters["plugin"]?.Split(';').FirstOrDefault(t => t.Contains("obfs-host"));
|
var obfsHost = queryParameters["plugin"]?.Split(';').FirstOrDefault(t => t.Contains("obfs-host"));
|
||||||
if (queryParameters["plugin"].Contains("obfs=http") && !Utils.IsNullOrEmpty(obfsHost))
|
if (queryParameters["plugin"].Contains("obfs=http") && Utils.IsNotEmpty(obfsHost))
|
||||||
{
|
{
|
||||||
obfsHost = obfsHost?.Replace("obfs-host=", "");
|
obfsHost = obfsHost?.Replace("obfs-host=", "");
|
||||||
item.network = Global.DefaultNetwork;
|
item.network = Global.DefaultNetwork;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
string url = string.Empty;
|
string url = string.Empty;
|
||||||
|
|
||||||
string remark = string.Empty;
|
string remark = string.Empty;
|
||||||
if (!Utils.IsNullOrEmpty(item.remarks))
|
if (Utils.IsNotEmpty(item.remarks))
|
||||||
{
|
{
|
||||||
remark = "#" + Utils.UrlEncode(item.remarks);
|
remark = "#" + Utils.UrlEncode(item.remarks);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
string url = string.Empty;
|
string url = string.Empty;
|
||||||
|
|
||||||
string remark = string.Empty;
|
string remark = string.Empty;
|
||||||
if (!Utils.IsNullOrEmpty(item.remarks))
|
if (Utils.IsNotEmpty(item.remarks))
|
||||||
{
|
{
|
||||||
remark = "#" + Utils.UrlEncode(item.remarks);
|
remark = "#" + Utils.UrlEncode(item.remarks);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,16 +36,16 @@
|
||||||
string url = string.Empty;
|
string url = string.Empty;
|
||||||
|
|
||||||
string remark = string.Empty;
|
string remark = string.Empty;
|
||||||
if (!Utils.IsNullOrEmpty(item.remarks))
|
if (Utils.IsNotEmpty(item.remarks))
|
||||||
{
|
{
|
||||||
remark = "#" + Utils.UrlEncode(item.remarks);
|
remark = "#" + Utils.UrlEncode(item.remarks);
|
||||||
}
|
}
|
||||||
var dicQuery = new Dictionary<string, string>();
|
var dicQuery = new Dictionary<string, string>();
|
||||||
if (!Utils.IsNullOrEmpty(item.sni))
|
if (Utils.IsNotEmpty(item.sni))
|
||||||
{
|
{
|
||||||
dicQuery.Add("sni", item.sni);
|
dicQuery.Add("sni", item.sni);
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(item.alpn))
|
if (Utils.IsNotEmpty(item.alpn))
|
||||||
{
|
{
|
||||||
dicQuery.Add("alpn", Utils.UrlEncode(item.alpn));
|
dicQuery.Add("alpn", Utils.UrlEncode(item.alpn));
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,12 +33,12 @@
|
||||||
string url = string.Empty;
|
string url = string.Empty;
|
||||||
|
|
||||||
string remark = string.Empty;
|
string remark = string.Empty;
|
||||||
if (!Utils.IsNullOrEmpty(item.remarks))
|
if (Utils.IsNotEmpty(item.remarks))
|
||||||
{
|
{
|
||||||
remark = "#" + Utils.UrlEncode(item.remarks);
|
remark = "#" + Utils.UrlEncode(item.remarks);
|
||||||
}
|
}
|
||||||
var dicQuery = new Dictionary<string, string>();
|
var dicQuery = new Dictionary<string, string>();
|
||||||
if (!Utils.IsNullOrEmpty(item.security))
|
if (Utils.IsNotEmpty(item.security))
|
||||||
{
|
{
|
||||||
dicQuery.Add("encryption", item.security);
|
dicQuery.Add("encryption", item.security);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,12 +78,12 @@
|
||||||
item.alterId = Utils.ToInt(vmessQRCode.aid);
|
item.alterId = Utils.ToInt(vmessQRCode.aid);
|
||||||
item.security = Utils.ToString(vmessQRCode.scy);
|
item.security = Utils.ToString(vmessQRCode.scy);
|
||||||
|
|
||||||
item.security = !Utils.IsNullOrEmpty(vmessQRCode.scy) ? vmessQRCode.scy : Global.DefaultSecurity;
|
item.security = Utils.IsNotEmpty(vmessQRCode.scy) ? vmessQRCode.scy : Global.DefaultSecurity;
|
||||||
if (!Utils.IsNullOrEmpty(vmessQRCode.net))
|
if (Utils.IsNotEmpty(vmessQRCode.net))
|
||||||
{
|
{
|
||||||
item.network = vmessQRCode.net;
|
item.network = vmessQRCode.net;
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(vmessQRCode.type))
|
if (Utils.IsNotEmpty(vmessQRCode.type))
|
||||||
{
|
{
|
||||||
item.headerType = vmessQRCode.type;
|
item.headerType = vmessQRCode.type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,25 +34,25 @@
|
||||||
string url = string.Empty;
|
string url = string.Empty;
|
||||||
|
|
||||||
string remark = string.Empty;
|
string remark = string.Empty;
|
||||||
if (!Utils.IsNullOrEmpty(item.remarks))
|
if (Utils.IsNotEmpty(item.remarks))
|
||||||
{
|
{
|
||||||
remark = "#" + Utils.UrlEncode(item.remarks);
|
remark = "#" + Utils.UrlEncode(item.remarks);
|
||||||
}
|
}
|
||||||
|
|
||||||
var dicQuery = new Dictionary<string, string>();
|
var dicQuery = new Dictionary<string, string>();
|
||||||
if (!Utils.IsNullOrEmpty(item.publicKey))
|
if (Utils.IsNotEmpty(item.publicKey))
|
||||||
{
|
{
|
||||||
dicQuery.Add("publickey", Utils.UrlEncode(item.publicKey));
|
dicQuery.Add("publickey", Utils.UrlEncode(item.publicKey));
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(item.path))
|
if (Utils.IsNotEmpty(item.path))
|
||||||
{
|
{
|
||||||
dicQuery.Add("reserved", Utils.UrlEncode(item.path));
|
dicQuery.Add("reserved", Utils.UrlEncode(item.path));
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(item.requestHost))
|
if (Utils.IsNotEmpty(item.requestHost))
|
||||||
{
|
{
|
||||||
dicQuery.Add("address", Utils.UrlEncode(item.requestHost));
|
dicQuery.Add("address", Utils.UrlEncode(item.requestHost));
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(item.shortId))
|
if (Utils.IsNotEmpty(item.shortId))
|
||||||
{
|
{
|
||||||
dicQuery.Add("mtu", Utils.UrlEncode(item.shortId));
|
dicQuery.Add("mtu", Utils.UrlEncode(item.shortId));
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,11 +104,11 @@
|
||||||
from ProfileItem a
|
from ProfileItem a
|
||||||
left join SubItem b on a.subid = b.id
|
left join SubItem b on a.subid = b.id
|
||||||
where 1=1 ";
|
where 1=1 ";
|
||||||
if (!Utils.IsNullOrEmpty(subid))
|
if (Utils.IsNotEmpty(subid))
|
||||||
{
|
{
|
||||||
sql += $" and a.subid = '{subid}'";
|
sql += $" and a.subid = '{subid}'";
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(filter))
|
if (Utils.IsNotEmpty(filter))
|
||||||
{
|
{
|
||||||
if (filter.Contains('\''))
|
if (filter.Contains('\''))
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace ServiceLib.Handler
|
||||||
|
|
||||||
private void IndexIdEnqueue(string indexId)
|
private void IndexIdEnqueue(string indexId)
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(indexId) && !_queIndexIds.Contains(indexId))
|
if (Utils.IsNotEmpty(indexId) && !_queIndexIds.Contains(indexId))
|
||||||
{
|
{
|
||||||
_queIndexIds.Enqueue(indexId);
|
_queIndexIds.Enqueue(indexId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ namespace ServiceLib.Handler.Statistics
|
||||||
while (!res.CloseStatus.HasValue)
|
while (!res.CloseStatus.HasValue)
|
||||||
{
|
{
|
||||||
var result = Encoding.UTF8.GetString(buffer, 0, res.Count);
|
var result = Encoding.UTF8.GetString(buffer, 0, res.Count);
|
||||||
if (!Utils.IsNullOrEmpty(result))
|
if (Utils.IsNotEmpty(result))
|
||||||
{
|
{
|
||||||
ParseOutput(result, out ulong up, out ulong down);
|
ParseOutput(result, out ulong up, out ulong down);
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ namespace ServiceLib.Handler
|
||||||
string url = item.url.TrimEx();
|
string url = item.url.TrimEx();
|
||||||
string userAgent = item.userAgent.TrimEx();
|
string userAgent = item.userAgent.TrimEx();
|
||||||
string hashCode = $"{item.remarks}->";
|
string hashCode = $"{item.remarks}->";
|
||||||
if (Utils.IsNullOrEmpty(id) || Utils.IsNullOrEmpty(url) || (!Utils.IsNullOrEmpty(subId) && item.id != subId))
|
if (Utils.IsNullOrEmpty(id) || Utils.IsNullOrEmpty(url) || (Utils.IsNotEmpty(subId) && item.id != subId))
|
||||||
{
|
{
|
||||||
//_updateFunc(false, $"{hashCode}{ResUI.MsgNoValidSubscription}");
|
//_updateFunc(false, $"{hashCode}{ResUI.MsgNoValidSubscription}");
|
||||||
continue;
|
continue;
|
||||||
|
@ -169,7 +169,7 @@ namespace ServiceLib.Handler
|
||||||
//one url
|
//one url
|
||||||
url = Utils.GetPunycode(url);
|
url = Utils.GetPunycode(url);
|
||||||
//convert
|
//convert
|
||||||
if (!Utils.IsNullOrEmpty(item.convertTarget))
|
if (Utils.IsNotEmpty(item.convertTarget))
|
||||||
{
|
{
|
||||||
var subConvertUrl = Utils.IsNullOrEmpty(config.constItem.subConvertUrl) ? Global.SubConvertUrls.FirstOrDefault() : config.constItem.subConvertUrl;
|
var subConvertUrl = Utils.IsNullOrEmpty(config.constItem.subConvertUrl) ? Global.SubConvertUrls.FirstOrDefault() : config.constItem.subConvertUrl;
|
||||||
url = string.Format(subConvertUrl!, Utils.UrlEncode(url));
|
url = string.Format(subConvertUrl!, Utils.UrlEncode(url));
|
||||||
|
@ -189,9 +189,9 @@ namespace ServiceLib.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
//more url
|
//more url
|
||||||
if (Utils.IsNullOrEmpty(item.convertTarget) && !Utils.IsNullOrEmpty(item.moreUrl.TrimEx()))
|
if (Utils.IsNullOrEmpty(item.convertTarget) && Utils.IsNotEmpty(item.moreUrl.TrimEx()))
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(result) && Utils.IsBase64String(result!))
|
if (Utils.IsNotEmpty(result) && Utils.IsBase64String(result!))
|
||||||
{
|
{
|
||||||
result = Utils.Base64Decode(result);
|
result = Utils.Base64Decode(result);
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ namespace ServiceLib.Handler
|
||||||
{
|
{
|
||||||
result2 = await downloadHandle.TryDownloadString(url2, false, userAgent);
|
result2 = await downloadHandle.TryDownloadString(url2, false, userAgent);
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(result2))
|
if (Utils.IsNotEmpty(result2))
|
||||||
{
|
{
|
||||||
if (Utils.IsBase64String(result2!))
|
if (Utils.IsBase64String(result2!))
|
||||||
{
|
{
|
||||||
|
@ -277,7 +277,7 @@ namespace ServiceLib.Handler
|
||||||
var url = coreInfo?.coreReleaseApiUrl;
|
var url = coreInfo?.coreReleaseApiUrl;
|
||||||
|
|
||||||
var result = await downloadHandle.DownloadStringAsync(url, true, Global.AppName);
|
var result = await downloadHandle.DownloadStringAsync(url, true, Global.AppName);
|
||||||
if (!Utils.IsNullOrEmpty(result))
|
if (Utils.IsNotEmpty(result))
|
||||||
{
|
{
|
||||||
return await ParseDownloadUrl(type, result, preRelease);
|
return await ParseDownloadUrl(type, result, preRelease);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ namespace ServiceLib.ViewModels
|
||||||
if (ConfigHandler.AddCustomServer(_config, item, false) == 0)
|
if (ConfigHandler.AddCustomServer(_config, item, false) == 0)
|
||||||
{
|
{
|
||||||
_noticeHandler?.Enqueue(ResUI.SuccessfullyImportedCustomServer);
|
_noticeHandler?.Enqueue(ResUI.SuccessfullyImportedCustomServer);
|
||||||
if (!Utils.IsNullOrEmpty(item.indexId))
|
if (Utils.IsNotEmpty(item.indexId))
|
||||||
{
|
{
|
||||||
SelectedSource = JsonUtils.DeepCopy(item);
|
SelectedSource = JsonUtils.DeepCopy(item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace ServiceLib.ViewModels
|
||||||
|
|
||||||
var canEditRemove = this.WhenAnyValue(
|
var canEditRemove = this.WhenAnyValue(
|
||||||
x => x.SelectedSource,
|
x => x.SelectedSource,
|
||||||
selectedSource => selectedSource != null && !string.IsNullOrEmpty(selectedSource.id));
|
selectedSource => selectedSource != null && Utils.IsNotEmpty(selectedSource.id));
|
||||||
|
|
||||||
this.WhenAnyValue(
|
this.WhenAnyValue(
|
||||||
x => x.SortingSelected,
|
x => x.SortingSelected,
|
||||||
|
@ -121,7 +121,7 @@ namespace ServiceLib.ViewModels
|
||||||
var lstModel = new List<ClashConnectionModel>();
|
var lstModel = new List<ClashConnectionModel>();
|
||||||
foreach (var item in connections ?? [])
|
foreach (var item in connections ?? [])
|
||||||
{
|
{
|
||||||
var host = $"{(string.IsNullOrEmpty(item.metadata.host) ? item.metadata.destinationIP : item.metadata.host)}:{item.metadata.destinationPort}";
|
var host = $"{(Utils.IsNullOrEmpty(item.metadata.host) ? item.metadata.destinationIP : item.metadata.host)}:{item.metadata.destinationPort}";
|
||||||
if (HostFilter.IsNotEmpty() && !host.Contains(HostFilter))
|
if (HostFilter.IsNotEmpty() && !host.Contains(HostFilter))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace ServiceLib.ViewModels
|
||||||
|
|
||||||
this.WhenAnyValue(
|
this.WhenAnyValue(
|
||||||
x => x.SelectedGroup,
|
x => x.SelectedGroup,
|
||||||
y => y != null && !string.IsNullOrEmpty(y.name))
|
y => y != null && Utils.IsNotEmpty(y.name))
|
||||||
.Subscribe(c => RefreshProxyDetails(c));
|
.Subscribe(c => RefreshProxyDetails(c));
|
||||||
|
|
||||||
this.WhenAnyValue(
|
this.WhenAnyValue(
|
||||||
|
@ -194,7 +194,7 @@ namespace ServiceLib.ViewModels
|
||||||
{
|
{
|
||||||
foreach (var it in proxyGroups)
|
foreach (var it in proxyGroups)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(it.name) || !_proxies.ContainsKey(it.name))
|
if (Utils.IsNullOrEmpty(it.name) || !_proxies.ContainsKey(it.name))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ namespace ServiceLib.ViewModels
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var item = _proxyGroups.Where(t => t.name == kv.Key).FirstOrDefault();
|
var item = _proxyGroups.Where(t => t.name == kv.Key).FirstOrDefault();
|
||||||
if (item != null && !string.IsNullOrEmpty(item.name))
|
if (item != null && Utils.IsNotEmpty(item.name))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ namespace ServiceLib.ViewModels
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var name = SelectedGroup?.name;
|
var name = SelectedGroup?.name;
|
||||||
if (string.IsNullOrEmpty(name))
|
if (Utils.IsNullOrEmpty(name))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -342,21 +342,21 @@ namespace ServiceLib.ViewModels
|
||||||
|
|
||||||
public void SetActiveProxy()
|
public void SetActiveProxy()
|
||||||
{
|
{
|
||||||
if (SelectedGroup == null || string.IsNullOrEmpty(SelectedGroup.name))
|
if (SelectedGroup == null || Utils.IsNullOrEmpty(SelectedGroup.name))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (SelectedDetail == null || string.IsNullOrEmpty(SelectedDetail.name))
|
if (SelectedDetail == null || Utils.IsNullOrEmpty(SelectedDetail.name))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var name = SelectedGroup.name;
|
var name = SelectedGroup.name;
|
||||||
if (string.IsNullOrEmpty(name))
|
if (Utils.IsNullOrEmpty(name))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var nameNode = SelectedDetail.name;
|
var nameNode = SelectedDetail.name;
|
||||||
if (string.IsNullOrEmpty(nameNode))
|
if (Utils.IsNullOrEmpty(nameNode))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -393,7 +393,7 @@ namespace ServiceLib.ViewModels
|
||||||
GetClashProxies(true);
|
GetClashProxies(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(result))
|
if (Utils.IsNullOrEmpty(result))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace ServiceLib.ViewModels
|
||||||
|
|
||||||
private async Task SaveSettingAsync()
|
private async Task SaveSettingAsync()
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(normalDNS))
|
if (Utils.IsNotEmpty(normalDNS))
|
||||||
{
|
{
|
||||||
var obj = JsonUtils.ParseJson(normalDNS);
|
var obj = JsonUtils.ParseJson(normalDNS);
|
||||||
if (obj != null && obj["servers"] != null)
|
if (obj != null && obj["servers"] != null)
|
||||||
|
@ -73,7 +73,7 @@ namespace ServiceLib.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(normalDNS2))
|
if (Utils.IsNotEmpty(normalDNS2))
|
||||||
{
|
{
|
||||||
var obj2 = JsonUtils.Deserialize<Dns4Sbox>(normalDNS2);
|
var obj2 = JsonUtils.Deserialize<Dns4Sbox>(normalDNS2);
|
||||||
if (obj2 == null)
|
if (obj2 == null)
|
||||||
|
@ -82,7 +82,7 @@ namespace ServiceLib.ViewModels
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(tunDNS2))
|
if (Utils.IsNotEmpty(tunDNS2))
|
||||||
{
|
{
|
||||||
var obj2 = JsonUtils.Deserialize<Dns4Sbox>(tunDNS2);
|
var obj2 = JsonUtils.Deserialize<Dns4Sbox>(tunDNS2);
|
||||||
if (obj2 == null)
|
if (obj2 == null)
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace ServiceLib.ViewModels
|
||||||
{
|
{
|
||||||
//filter msg
|
//filter msg
|
||||||
if (MsgFilter != _lastMsgFilter) _lastMsgFilterNotAvailable = false;
|
if (MsgFilter != _lastMsgFilter) _lastMsgFilterNotAvailable = false;
|
||||||
if (!Utils.IsNullOrEmpty(MsgFilter) && !_lastMsgFilterNotAvailable)
|
if (Utils.IsNotEmpty(MsgFilter) && !_lastMsgFilterNotAvailable)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -265,13 +265,13 @@ namespace ServiceLib.ViewModels
|
||||||
var item = _profileItems.Where(it => it.indexId == result.IndexId).FirstOrDefault();
|
var item = _profileItems.Where(it => it.indexId == result.IndexId).FirstOrDefault();
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(result.Delay))
|
if (Utils.IsNotEmpty(result.Delay))
|
||||||
{
|
{
|
||||||
int.TryParse(result.Delay, out int temp);
|
int.TryParse(result.Delay, out int temp);
|
||||||
item.delay = temp;
|
item.delay = temp;
|
||||||
item.delayVal = $"{result.Delay} {Global.DelayUnit}";
|
item.delayVal = $"{result.Delay} {Global.DelayUnit}";
|
||||||
}
|
}
|
||||||
if (!Utils.IsNullOrEmpty(result.Speed))
|
if (Utils.IsNotEmpty(result.Speed))
|
||||||
{
|
{
|
||||||
item.speedVal = $"{result.Speed} {Global.SpeedUnit}";
|
item.speedVal = $"{result.Speed} {Global.SpeedUnit}";
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace ServiceLib.ViewModels
|
||||||
|| SelectedSource.ip?.Count > 0
|
|| SelectedSource.ip?.Count > 0
|
||||||
|| SelectedSource.protocol?.Count > 0
|
|| SelectedSource.protocol?.Count > 0
|
||||||
|| SelectedSource.process?.Count > 0
|
|| SelectedSource.process?.Count > 0
|
||||||
|| !Utils.IsNullOrEmpty(SelectedSource.port);
|
|| Utils.IsNotEmpty(SelectedSource.port);
|
||||||
|
|
||||||
if (!hasRule)
|
if (!hasRule)
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace v2rayN.Desktop.ViewModels
|
||||||
y => y != null && !y.IsNullOrEmpty())
|
y => y != null && !y.IsNullOrEmpty())
|
||||||
.Subscribe(c =>
|
.Subscribe(c =>
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(CurrentLanguage) && _config.uiItem.currentLanguage != CurrentLanguage)
|
if (Utils.IsNotEmpty(CurrentLanguage) && _config.uiItem.currentLanguage != CurrentLanguage)
|
||||||
{
|
{
|
||||||
_config.uiItem.currentLanguage = CurrentLanguage;
|
_config.uiItem.currentLanguage = CurrentLanguage;
|
||||||
Thread.CurrentThread.CurrentUICulture = new(CurrentLanguage);
|
Thread.CurrentThread.CurrentUICulture = new(CurrentLanguage);
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace v2rayN.Converters
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var fontFamily = LazyConfig.Instance.Config.uiItem.currentFontFamily;
|
var fontFamily = LazyConfig.Instance.Config.uiItem.currentFontFamily;
|
||||||
if (!Utils.IsNullOrEmpty(fontFamily))
|
if (Utils.IsNotEmpty(fontFamily))
|
||||||
{
|
{
|
||||||
var fontPath = Utils.GetFontsPath();
|
var fontPath = Utils.GetFontsPath();
|
||||||
MyFont = new FontFamily(new Uri(@$"file:///{fontPath}\"), $"./#{fontFamily}");
|
MyFont = new FontFamily(new Uri(@$"file:///{fontPath}\"), $"./#{fontFamily}");
|
||||||
|
|
|
@ -156,7 +156,7 @@ namespace v2rayN.ViewModels
|
||||||
y => y != null && !y.IsNullOrEmpty())
|
y => y != null && !y.IsNullOrEmpty())
|
||||||
.Subscribe(c =>
|
.Subscribe(c =>
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(CurrentLanguage) && _config.uiItem.currentLanguage != CurrentLanguage)
|
if (Utils.IsNotEmpty(CurrentLanguage) && _config.uiItem.currentLanguage != CurrentLanguage)
|
||||||
{
|
{
|
||||||
_config.uiItem.currentLanguage = CurrentLanguage;
|
_config.uiItem.currentLanguage = CurrentLanguage;
|
||||||
Thread.CurrentThread.CurrentUICulture = new(CurrentLanguage);
|
Thread.CurrentThread.CurrentUICulture = new(CurrentLanguage);
|
||||||
|
|
Loading…
Reference in a new issue