mirror of https://github.com/2dust/v2rayN
优先去除旧(顶)项。严格检查,避免删除参数不同的配置。
parent
1922f30f0f
commit
cf195c7694
|
@ -323,14 +323,32 @@ namespace v2rayN
|
|||
public static void DedupServerList(List<Mode.VmessItem> source, out List<Mode.VmessItem> result)
|
||||
{
|
||||
var list = new List<Mode.VmessItem>();
|
||||
source.Reverse(); // Remove the early items first
|
||||
|
||||
bool _isAdded(Mode.VmessItem o, Mode.VmessItem n)
|
||||
{
|
||||
return o.configVersion == n.configVersion &&
|
||||
o.configType == n.configType &&
|
||||
o.address == n.address &&
|
||||
o.port == n.port &&
|
||||
o.id == n.id &&
|
||||
o.alterId == n.alterId &&
|
||||
o.security == n.security &&
|
||||
o.network == n.network &&
|
||||
o.headerType == n.headerType &&
|
||||
o.requestHost == n.requestHost &&
|
||||
o.path == n.path &&
|
||||
o.streamSecurity == n.streamSecurity;
|
||||
// skip (will remove) different remarks
|
||||
}
|
||||
foreach (var item in source)
|
||||
{
|
||||
if (!list.Exists(i => item.address == i.address && item.port == i.port && item.path == i.path))
|
||||
if (!list.Exists(i => _isAdded(i, item)))
|
||||
{
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
list.Reverse();
|
||||
result = list;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue