mirror of
https://github.com/2dust/v2rayN.git
synced 2026-02-28 21:23:04 +00:00
Remove unused code
This commit is contained in:
parent
189ab47fa9
commit
0eae23ace0
3 changed files with 5 additions and 49 deletions
|
|
@ -262,8 +262,11 @@ public sealed class AppManager
|
||||||
public async Task MigrateProfileExtra()
|
public async Task MigrateProfileExtra()
|
||||||
{
|
{
|
||||||
#pragma warning disable CS0618
|
#pragma warning disable CS0618
|
||||||
|
var list = await SQLiteHelper.Instance.TableAsync<ProfileGroupItem>().ToListAsync();
|
||||||
|
var groupItems = new ConcurrentDictionary<string, ProfileGroupItem>(list.Where(t => !string.IsNullOrEmpty(t.IndexId)).ToDictionary(t => t.IndexId!));
|
||||||
|
|
||||||
const int pageSize = 500;
|
const int pageSize = 500;
|
||||||
int offset = 0;
|
var offset = 0;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
|
@ -286,7 +289,7 @@ public sealed class AppManager
|
||||||
if (item.ConfigType is EConfigType.PolicyGroup or EConfigType.ProxyChain)
|
if (item.ConfigType is EConfigType.PolicyGroup or EConfigType.ProxyChain)
|
||||||
{
|
{
|
||||||
extra.GroupType = nameof(item.ConfigType);
|
extra.GroupType = nameof(item.ConfigType);
|
||||||
ProfileGroupItemManager.Instance.TryGet(item.IndexId, out var groupItem);
|
groupItems.TryGetValue(item.IndexId, out var groupItem);
|
||||||
if (groupItem != null && !groupItem.NotHasChild())
|
if (groupItem != null && !groupItem.NotHasChild())
|
||||||
{
|
{
|
||||||
extra.ChildItems = groupItem.ChildItems;
|
extra.ChildItems = groupItem.ChildItems;
|
||||||
|
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
namespace ServiceLib.Manager;
|
|
||||||
|
|
||||||
[Obsolete("Use GroupProfileManager instead.")]
|
|
||||||
public class ProfileGroupItemManager
|
|
||||||
{
|
|
||||||
private static readonly Lazy<ProfileGroupItemManager> _instance = new(() => new());
|
|
||||||
private ConcurrentDictionary<string, ProfileGroupItem> _items = new();
|
|
||||||
|
|
||||||
public static ProfileGroupItemManager Instance => _instance.Value;
|
|
||||||
private static readonly string _tag = "ProfileGroupItemManager";
|
|
||||||
|
|
||||||
private ProfileGroupItemManager()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Init()
|
|
||||||
{
|
|
||||||
await InitData();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read-only getters: do not create or mark dirty
|
|
||||||
public bool TryGet(string indexId, out ProfileGroupItem? item)
|
|
||||||
{
|
|
||||||
item = null;
|
|
||||||
if (string.IsNullOrWhiteSpace(indexId))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _items.TryGetValue(indexId, out item);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task InitData()
|
|
||||||
{
|
|
||||||
await SQLiteHelper.Instance.ExecuteAsync($"delete from ProfileGroupItem where IndexId not in ( select indexId from ProfileItem )");
|
|
||||||
|
|
||||||
var list = await SQLiteHelper.Instance.TableAsync<ProfileGroupItem>().ToListAsync();
|
|
||||||
_items = new ConcurrentDictionary<string, ProfileGroupItem>(list.Where(t => !string.IsNullOrEmpty(t.IndexId)).ToDictionary(t => t.IndexId!));
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task ClearAll()
|
|
||||||
{
|
|
||||||
await SQLiteHelper.Instance.ExecuteAsync($"delete from ProfileGroupItem ");
|
|
||||||
_items.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -259,7 +259,6 @@ public class MainWindowViewModel : MyReactiveObject
|
||||||
await ConfigHandler.InitBuiltinDNS(_config);
|
await ConfigHandler.InitBuiltinDNS(_config);
|
||||||
await ConfigHandler.InitBuiltinFullConfigTemplate(_config);
|
await ConfigHandler.InitBuiltinFullConfigTemplate(_config);
|
||||||
await ProfileExManager.Instance.Init();
|
await ProfileExManager.Instance.Init();
|
||||||
await ProfileGroupItemManager.Instance.Init();
|
|
||||||
await CoreManager.Instance.Init(_config, UpdateHandler);
|
await CoreManager.Instance.Init(_config, UpdateHandler);
|
||||||
TaskManager.Instance.RegUpdateTask(_config, UpdateTaskHandler);
|
TaskManager.Instance.RegUpdateTask(_config, UpdateTaskHandler);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue