mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-05 12:04:59 +03:00
Refactor node pre check (#8848)
* Refactor node pre check * Rename method * I18n * Add remark not found warnings * Fix * Fix * Fix * Update v2rayN/ServiceLib/Handler/CoreConfigHandler.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -143,26 +143,27 @@ public class GroupProfileManager
|
||||
.ToList() ?? [];
|
||||
}
|
||||
|
||||
public static async Task<List<ProfileItem>> GetAllChildProfileItems(ProfileItem profileItem)
|
||||
public static async Task<Dictionary<string, ProfileItem>> GetAllChildProfileItems(ProfileItem profileItem)
|
||||
{
|
||||
var allChildItems = new List<ProfileItem>();
|
||||
var itemMap = new Dictionary<string, ProfileItem>();
|
||||
var visited = new HashSet<string>();
|
||||
|
||||
await CollectChildItems(profileItem, allChildItems, visited);
|
||||
await CollectChildItems(profileItem, itemMap, visited);
|
||||
|
||||
return allChildItems;
|
||||
return itemMap;
|
||||
}
|
||||
|
||||
private static async Task CollectChildItems(ProfileItem profileItem, List<ProfileItem> allChildItems, HashSet<string> visited)
|
||||
private static async Task CollectChildItems(ProfileItem profileItem, Dictionary<string, ProfileItem> itemMap,
|
||||
HashSet<string> visited)
|
||||
{
|
||||
var (childItems, _) = await GetChildProfileItems(profileItem);
|
||||
foreach (var child in childItems.Where(child => visited.Add(child.IndexId)))
|
||||
{
|
||||
allChildItems.Add(child);
|
||||
itemMap[child.IndexId] = child;
|
||||
|
||||
if (child.ConfigType.IsGroupType())
|
||||
{
|
||||
await CollectChildItems(child, allChildItems, visited);
|
||||
await CollectChildItems(child, itemMap, visited);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user