允许设置去重保留较早或较晚的项

This commit is contained in:
YFdyh000
2020-03-15 01:56:05 +08:00
parent cf195c7694
commit 5dffb30b27
7 changed files with 57 additions and 7 deletions
+3 -3
View File
@@ -320,10 +320,10 @@ namespace v2rayN
return $"{string.Format("{0:f1}", result)} {unit}";
}
public static void DedupServerList(List<Mode.VmessItem> source, out List<Mode.VmessItem> result)
public static void DedupServerList(List<Mode.VmessItem> source, out List<Mode.VmessItem> result, bool keepOlder)
{
var list = new List<Mode.VmessItem>();
source.Reverse(); // Remove the early items first
if (!keepOlder) source.Reverse(); // Remove the early items first
bool _isAdded(Mode.VmessItem o, Mode.VmessItem n)
{
@@ -348,7 +348,7 @@ namespace v2rayN
list.Add(item);
}
}
list.Reverse();
if (!keepOlder) list.Reverse();
result = list;
}