diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index 2c6428d6..33a5c52a 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -1098,7 +1098,7 @@ public static class ConfigHandler await SQLiteHelper.Instance.ReplaceAsync(profileItem); if (profileGroupItem != null) { - profileGroupItem.ParentIndexId = profileItem.IndexId; + profileGroupItem.IndexId = profileItem.IndexId; await ProfileGroupItemManager.Instance.SaveItemAsync(profileGroupItem); } else @@ -1233,7 +1233,7 @@ public static class ConfigHandler { ChildItems = childProfileIndexId, MultipleLoad = multipleLoad, - ParentIndexId = indexId, + IndexId = indexId, }; var ret = await AddGroupServerCommon(config, profile, profileGroup, true); result.Success = ret == 0; diff --git a/v2rayN/ServiceLib/Manager/AppManager.cs b/v2rayN/ServiceLib/Manager/AppManager.cs index 08e96857..c66f76df 100644 --- a/v2rayN/ServiceLib/Manager/AppManager.cs +++ b/v2rayN/ServiceLib/Manager/AppManager.cs @@ -208,13 +208,13 @@ public sealed class AppManager return await SQLiteHelper.Instance.TableAsync().FirstOrDefaultAsync(it => it.Remarks == remarks); } - public async Task GetProfileGroupItem(string parentIndexId) + public async Task GetProfileGroupItem(string indexId) { - if (parentIndexId.IsNullOrEmpty()) + if (indexId.IsNullOrEmpty()) { return null; } - return await SQLiteHelper.Instance.TableAsync().FirstOrDefaultAsync(it => it.ParentIndexId == parentIndexId); + return await SQLiteHelper.Instance.TableAsync().FirstOrDefaultAsync(it => it.IndexId == indexId); } public async Task?> RoutingItems() diff --git a/v2rayN/ServiceLib/Manager/ProfileGroupItemManager.cs b/v2rayN/ServiceLib/Manager/ProfileGroupItemManager.cs index 745186c2..09e6461f 100644 --- a/v2rayN/ServiceLib/Manager/ProfileGroupItemManager.cs +++ b/v2rayN/ServiceLib/Manager/ProfileGroupItemManager.cs @@ -38,17 +38,17 @@ public class ProfileGroupItemManager private async Task InitData() { - await SQLiteHelper.Instance.ExecuteAsync($"delete from ProfileGroupItem where parentIndexId not in ( select indexId from ProfileItem )"); + await SQLiteHelper.Instance.ExecuteAsync($"delete from ProfileGroupItem where IndexId not in ( select indexId from ProfileItem )"); var list = await SQLiteHelper.Instance.TableAsync().ToListAsync(); - _items = new ConcurrentDictionary(list.Where(t => !string.IsNullOrEmpty(t.ParentIndexId)).ToDictionary(t => t.ParentIndexId!)); + _items = new ConcurrentDictionary(list.Where(t => !string.IsNullOrEmpty(t.IndexId)).ToDictionary(t => t.IndexId!)); } private ProfileGroupItem AddProfileGroupItem(string indexId) { var profileGroupItem = new ProfileGroupItem() { - ParentIndexId = indexId, + IndexId = indexId, ChildItems = string.Empty, MultipleLoad = EMultipleLoad.LeastPing }; @@ -78,19 +78,19 @@ public class ProfileGroupItemManager try { var lstExists = await SQLiteHelper.Instance.TableAsync().ToListAsync(); - var existsMap = lstExists.Where(t => !string.IsNullOrEmpty(t.ParentIndexId)).ToDictionary(t => t.ParentIndexId!); + var existsMap = lstExists.Where(t => !string.IsNullOrEmpty(t.IndexId)).ToDictionary(t => t.IndexId!); var lstInserts = new List(); var lstUpdates = new List(); foreach (var item in _items.Values) { - if (string.IsNullOrEmpty(item.ParentIndexId)) + if (string.IsNullOrEmpty(item.IndexId)) { continue; } - if (existsMap.ContainsKey(item.ParentIndexId)) + if (existsMap.ContainsKey(item.IndexId)) { lstUpdates.Add(item); } @@ -140,16 +140,16 @@ public class ProfileGroupItemManager throw new ArgumentNullException(nameof(item)); } - if (string.IsNullOrWhiteSpace(item.ParentIndexId)) + if (string.IsNullOrWhiteSpace(item.IndexId)) { - throw new ArgumentException("ParentIndexId required", nameof(item)); + throw new ArgumentException("IndexId required", nameof(item)); } - _items[item.ParentIndexId] = item; + _items[item.IndexId] = item; try { - var lst = await SQLiteHelper.Instance.TableAsync().Where(t => t.ParentIndexId == item.ParentIndexId).ToListAsync(); + var lst = await SQLiteHelper.Instance.TableAsync().Where(t => t.IndexId == item.IndexId).ToListAsync(); if (lst != null && lst.Count > 0) { await SQLiteHelper.Instance.UpdateAllAsync(new List { item }); @@ -250,11 +250,11 @@ public class ProfileGroupItemManager return childProfiles; } - public static async Task> GetAllChildDomainAddresses(string parentIndexId) + public static async Task> GetAllChildDomainAddresses(string indexId) { // include grand children var childAddresses = new HashSet(); - if (!Instance.TryGet(parentIndexId, out var groupItem) || groupItem.ChildItems.IsNullOrEmpty()) + if (!Instance.TryGet(indexId, out var groupItem) || groupItem.ChildItems.IsNullOrEmpty()) return childAddresses; var childIds = Utils.String2List(groupItem.ChildItems); diff --git a/v2rayN/ServiceLib/Models/ProfileGroupItem.cs b/v2rayN/ServiceLib/Models/ProfileGroupItem.cs index 6fbe1d9c..1030d6de 100644 --- a/v2rayN/ServiceLib/Models/ProfileGroupItem.cs +++ b/v2rayN/ServiceLib/Models/ProfileGroupItem.cs @@ -6,7 +6,7 @@ namespace ServiceLib.Models; public class ProfileGroupItem { [PrimaryKey] - public string ParentIndexId { get; set; } + public string IndexId { get; set; } public string ChildItems { get; set; } diff --git a/v2rayN/ServiceLib/ViewModels/AddGroupServerViewModel.cs b/v2rayN/ServiceLib/ViewModels/AddGroupServerViewModel.cs index 6607c2d3..130f447d 100644 --- a/v2rayN/ServiceLib/ViewModels/AddGroupServerViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/AddGroupServerViewModel.cs @@ -218,7 +218,7 @@ public class AddGroupServerViewModel : MyReactiveObject _ => EMultipleLoad.LeastPing, }; - var hasCycle = ProfileGroupItemManager.HasCycle(profileGroup.ParentIndexId); + var hasCycle = ProfileGroupItemManager.HasCycle(profileGroup.IndexId); if (hasCycle) { NoticeManager.Instance.Enqueue(string.Format(ResUI.GroupSelfReference, remarks));