mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-12 23:44:59 +03:00
@@ -656,10 +656,10 @@ public class Global
|
|||||||
{ ECoreType.Xray, "XTLS/Xray-core" },
|
{ ECoreType.Xray, "XTLS/Xray-core" },
|
||||||
{ ECoreType.sing_box, "SagerNet/sing-box" },
|
{ ECoreType.sing_box, "SagerNet/sing-box" },
|
||||||
{ ECoreType.mihomo, "MetaCubeX/mihomo" },
|
{ ECoreType.mihomo, "MetaCubeX/mihomo" },
|
||||||
{ ECoreType.hysteria, "apernet/hysteria" },
|
{ ECoreType.hysteria, "HyNetworks/hysteria" },
|
||||||
{ ECoreType.hysteria2, "apernet/hysteria" },
|
{ ECoreType.hysteria2, "HyNetworks/hysteria" },
|
||||||
{ ECoreType.naiveproxy, "klzgrad/naiveproxy" },
|
{ ECoreType.naiveproxy, "klzgrad/naiveproxy" },
|
||||||
{ ECoreType.tuic, "EAimTY/tuic" },
|
{ ECoreType.tuic, "tuic-protocol/tuic" },
|
||||||
{ ECoreType.juicity, "juicity/juicity" },
|
{ ECoreType.juicity, "juicity/juicity" },
|
||||||
{ ECoreType.brook, "txthinking/brook" },
|
{ ECoreType.brook, "txthinking/brook" },
|
||||||
{ ECoreType.overtls, "ShadowsocksR-Live/overtls" },
|
{ ECoreType.overtls, "ShadowsocksR-Live/overtls" },
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ namespace ServiceLib.ViewModels;
|
|||||||
|
|
||||||
public partial class ClashProxiesViewModel : MyReactiveObject
|
public partial class ClashProxiesViewModel : MyReactiveObject
|
||||||
{
|
{
|
||||||
private readonly int _delayTimeout = 99999999;
|
private const int _delayTimeout = 99999999;
|
||||||
private ClashItem _clashItem = new();
|
private ClashItem _clashItem = new();
|
||||||
|
|
||||||
public ClashProxiesViewModel()
|
public ClashProxiesViewModel()
|
||||||
@@ -235,6 +235,11 @@ public partial class ClashProxiesViewModel : MyReactiveObject
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var dicCurrentDetails = new Dictionary<string, ClashProxyModel>();
|
||||||
|
foreach (var item in ProxyDetails)
|
||||||
|
{
|
||||||
|
dicCurrentDetails.TryAdd(item.Name, item);
|
||||||
|
}
|
||||||
var lstDetails = new List<ClashProxyModel>();
|
var lstDetails = new List<ClashProxyModel>();
|
||||||
foreach (var item in proxy.all)
|
foreach (var item in proxy.all)
|
||||||
{
|
{
|
||||||
@@ -243,15 +248,29 @@ public partial class ClashProxiesViewModel : MyReactiveObject
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var delay = proxy2.history?.Count > 0 ? proxy2.history.Last().delay : -1;
|
var delay = -1;
|
||||||
|
var hasData = false;
|
||||||
|
|
||||||
|
if (proxy2.history is { Count: > 0 })
|
||||||
|
{
|
||||||
|
delay = proxy2.history.Last().delay;
|
||||||
|
hasData = true;
|
||||||
|
}
|
||||||
|
else if (dicCurrentDetails.TryGetValue(item, out var detail))
|
||||||
|
{
|
||||||
|
delay = detail.Delay;
|
||||||
|
hasData = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var isValidDelay = delay is > 0 and not _delayTimeout;
|
||||||
|
|
||||||
lstDetails.Add(new ClashProxyModel
|
lstDetails.Add(new ClashProxyModel
|
||||||
{
|
{
|
||||||
IsActive = item == proxy.now,
|
IsActive = item == proxy.now,
|
||||||
Name = item,
|
Name = item,
|
||||||
Type = proxy2.type,
|
Type = proxy2.type,
|
||||||
Delay = delay <= 0 ? _delayTimeout : delay,
|
Delay = isValidDelay ? delay : _delayTimeout,
|
||||||
DelayName = delay <= 0 ? string.Empty : $"{delay}ms",
|
DelayName = !hasData ? string.Empty : (isValidDelay ? $"{delay}ms" : "-1"),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// sort
|
// sort
|
||||||
@@ -362,8 +381,9 @@ public partial class ClashProxiesViewModel : MyReactiveObject
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
detail.Delay = Convert.ToInt32(result.Delay);
|
var isValid = int.TryParse(result.Delay, out var delay) && delay > 0 && delay != _delayTimeout;
|
||||||
detail.DelayName = $"{detail.Delay}ms";
|
detail.Delay = isValid ? delay : _delayTimeout;
|
||||||
|
detail.DelayName = isValid ? $"{delay}ms" : "-1";
|
||||||
await Task.CompletedTask;
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user