mirror of
https://github.com/2dust/v2rayN.git
synced 2026-02-18 08:13:02 +00:00
parent
9ea80671d3
commit
df016dd55c
2 changed files with 26 additions and 2 deletions
|
|
@ -94,4 +94,28 @@ public static class Extension
|
||||||
{
|
{
|
||||||
return configType is EConfigType.Custom or EConfigType.PolicyGroup or EConfigType.ProxyChain;
|
return configType is EConfigType.Custom or EConfigType.PolicyGroup or EConfigType.ProxyChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Safely adds elements from a collection to the list. Does nothing if the source is null.
|
||||||
|
/// </summary>
|
||||||
|
public static void AddRangeSafe<T>(this ICollection<T> destination, IEnumerable<T>? source)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(destination);
|
||||||
|
|
||||||
|
if (source is null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (destination is List<T> list)
|
||||||
|
{
|
||||||
|
list.AddRange(source);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in source)
|
||||||
|
{
|
||||||
|
destination.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -218,8 +218,8 @@ public class ActionPrecheckManager
|
||||||
|
|
||||||
var childIds = new List<string>();
|
var childIds = new List<string>();
|
||||||
var subItems = await ProfileGroupItemManager.GetSubChildProfileItems(group);
|
var subItems = await ProfileGroupItemManager.GetSubChildProfileItems(group);
|
||||||
childIds.AddRange(subItems.Select(p => p.IndexId));
|
childIds.AddRangeSafe(subItems.Select(p => p.IndexId));
|
||||||
childIds.AddRange(Utils.String2List(group.ChildItems));
|
childIds.AddRangeSafe(Utils.String2List(group.ChildItems));
|
||||||
|
|
||||||
foreach (var child in childIds)
|
foreach (var child in childIds)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue