Skip to content

Commit 54608ab

Browse files
committed
Adjust GroupProfileManager
1 parent 6167624 commit 54608ab

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

v2rayN/ServiceLib/Manager/GroupProfileManager.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public static async Task<bool> HasCycle(string? indexId, ProtocolExtraItem? extr
1212
return await HasCycle(indexId, extraInfo, new HashSet<string>(), new HashSet<string>());
1313
}
1414

15-
public static async Task<bool> HasCycle(string? indexId, ProtocolExtraItem? extraInfo, HashSet<string> visited, HashSet<string> stack)
15+
private static async Task<bool> HasCycle(string? indexId, ProtocolExtraItem? extraInfo, HashSet<string> visited, HashSet<string> stack)
1616
{
1717
if (indexId.IsNullOrEmpty() || extraInfo == null)
1818
{
@@ -75,20 +75,21 @@ public static async Task<bool> HasCycle(string? indexId, ProtocolExtraItem? extr
7575
return (await GetChildProfileItemsByProtocolExtra(protocolExtra), protocolExtra);
7676
}
7777

78-
public static async Task<List<ProfileItem>> GetChildProfileItemsByProtocolExtra(ProtocolExtraItem? protocolExtra)
78+
private static async Task<List<ProfileItem>> GetChildProfileItemsByProtocolExtra(ProtocolExtraItem? protocolExtra)
7979
{
8080
if (protocolExtra == null)
8181
{
8282
return new();
8383
}
84-
var items = await GetSelectedChildProfileItems(protocolExtra);
85-
var subItems = await GetSubChildProfileItems(protocolExtra);
86-
items.AddRange(subItems);
84+
85+
var items = new List<ProfileItem>();
86+
items.AddRange(await GetSubChildProfileItems(protocolExtra));
87+
items.AddRange(await GetSelectedChildProfileItems(protocolExtra));
8788

8889
return items;
8990
}
9091

91-
public static async Task<List<ProfileItem>> GetSelectedChildProfileItems(ProtocolExtraItem? extra)
92+
private static async Task<List<ProfileItem>> GetSelectedChildProfileItems(ProtocolExtraItem? extra)
9293
{
9394
if (extra == null || extra.ChildItems.IsNullOrEmpty())
9495
{
@@ -105,10 +106,10 @@ public static async Task<List<ProfileItem>> GetSelectedChildProfileItems(Protoco
105106
p.ConfigType != EConfigType.Custom
106107
)
107108
.ToList();
108-
return childProfiles;
109+
return childProfiles ?? new();
109110
}
110111

111-
public static async Task<List<ProfileItem>> GetSubChildProfileItems(ProtocolExtraItem? extra)
112+
private static async Task<List<ProfileItem>> GetSubChildProfileItems(ProtocolExtraItem? extra)
112113
{
113114
if (extra == null || extra.SubChildItems.IsNullOrEmpty())
114115
{

0 commit comments

Comments
 (0)