mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-28 08:04:58 +03:00
AI-optimized code
This commit is contained in:
@@ -11,9 +11,9 @@ namespace ServiceLib.Handler
|
||||
private Dictionary<string, ProxiesItem>? _proxies;
|
||||
public Dictionary<string, object> ProfileContent { get; set; }
|
||||
|
||||
public async Task<Tuple<ClashProxies, ClashProviders>?> GetClashProxiesAsync(Config config)
|
||||
public async Task<Tuple<ClashProxies, ClashProviders>?> GetClashProxiesAsync()
|
||||
{
|
||||
for (var i = 0; i < 5; i++)
|
||||
for (var i = 0; i < 3; i++)
|
||||
{
|
||||
var url = $"{GetApiUrl()}/proxies";
|
||||
var result = await HttpClientHelper.Instance.TryGetAsync(url);
|
||||
@@ -41,34 +41,26 @@ namespace ServiceLib.Handler
|
||||
{
|
||||
if (blAll)
|
||||
{
|
||||
for (var i = 0; i < 5; i++)
|
||||
{
|
||||
if (_proxies != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
await Task.Delay(5000);
|
||||
}
|
||||
if (_proxies == null)
|
||||
{
|
||||
return;
|
||||
await GetClashProxiesAsync();
|
||||
}
|
||||
lstProxy = new List<ClashProxyModel>();
|
||||
foreach (var kv in _proxies)
|
||||
foreach (var kv in _proxies ?? [])
|
||||
{
|
||||
if (Global.notAllowTestType.Contains(kv.Value.type.ToLower()))
|
||||
if (Global.notAllowTestType.Contains(kv.Value.type?.ToLower()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
lstProxy.Add(new ClashProxyModel()
|
||||
{
|
||||
Name = kv.Value.name,
|
||||
Type = kv.Value.type.ToLower(),
|
||||
Type = kv.Value.type?.ToLower(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (lstProxy == null)
|
||||
if (lstProxy is not { Count: > 0 })
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -157,7 +149,7 @@ namespace ServiceLib.Handler
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ClashConnections?> GetClashConnectionsAsync(Config config)
|
||||
public async Task<ClashConnections?> GetClashConnectionsAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user