diff --git a/v2rayN/ServiceLib.Tests/GlobalUsings.cs b/v2rayN/ServiceLib.Tests/GlobalUsings.cs index 1e4d98a0..ccceaff5 100644 --- a/v2rayN/ServiceLib.Tests/GlobalUsings.cs +++ b/v2rayN/ServiceLib.Tests/GlobalUsings.cs @@ -21,9 +21,9 @@ global using ServiceLib.Handler; global using ServiceLib.Handler.Builder; global using ServiceLib.Handler.Fmt; global using ServiceLib.Handler.SysProxy; +global using ServiceLib.Handler.Data; global using ServiceLib.Helper; global using ServiceLib.Manager; -global using ServiceLib.Manager.Data; global using ServiceLib.Models.CoreConfigs; global using ServiceLib.Models.Configs; global using ServiceLib.Models.Dto; diff --git a/v2rayN/ServiceLib.Tests/Handler/ConfigHandlerCustomSubscriptionTests.cs b/v2rayN/ServiceLib.Tests/Handler/ConfigHandlerCustomSubscriptionTests.cs index 19b84ea8..414e1c75 100644 --- a/v2rayN/ServiceLib.Tests/Handler/ConfigHandlerCustomSubscriptionTests.cs +++ b/v2rayN/ServiceLib.Tests/Handler/ConfigHandlerCustomSubscriptionTests.cs @@ -32,7 +32,7 @@ public class ConfigHandlerCustomSubscriptionTests oldProfile.IsSub = true; await SQLiteHelper.Instance.InsertAsync(oldProfile); - var count = await ConfigDbManager.AddBatchServers(config, FullXrayConfigs, subId, true); + var count = await ConfigDbHandler.AddBatchServers(config, FullXrayConfigs, subId, true); var profiles = await ConfigDbQuery.ProfileItems(subId) ?? []; await count.Should().BeEqualTo(2); @@ -66,7 +66,7 @@ public class ConfigHandlerCustomSubscriptionTests await SQLiteHelper.Instance.InsertAsync(existing); var invalidSubscription = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes("not a valid profile")); - var count = await ConfigDbManager.AddBatchServers(config, invalidSubscription, subId, true); + var count = await ConfigDbHandler.AddBatchServers(config, invalidSubscription, subId, true); var profiles = await ConfigDbQuery.ProfileItems(subId) ?? []; await (count < 1).Should().BeTrue(); diff --git a/v2rayN/ServiceLib/GlobalUsings.cs b/v2rayN/ServiceLib/GlobalUsings.cs index cbd350b2..80abb681 100644 --- a/v2rayN/ServiceLib/GlobalUsings.cs +++ b/v2rayN/ServiceLib/GlobalUsings.cs @@ -31,9 +31,9 @@ global using ServiceLib.Handler; global using ServiceLib.Handler.Builder; global using ServiceLib.Handler.Fmt; global using ServiceLib.Handler.SysProxy; +global using ServiceLib.Handler.Data; global using ServiceLib.Helper; global using ServiceLib.Manager; -global using ServiceLib.Manager.Data; global using ServiceLib.Models.Configs; global using ServiceLib.Models.CoreConfigs; global using ServiceLib.Models.Dto; diff --git a/v2rayN/ServiceLib/Handler/Builder/CoreConfigContextBuilder.cs b/v2rayN/ServiceLib/Handler/Builder/CoreConfigContextBuilder.cs index b9012c89..3677f565 100644 --- a/v2rayN/ServiceLib/Handler/Builder/CoreConfigContextBuilder.cs +++ b/v2rayN/ServiceLib/Handler/Builder/CoreConfigContextBuilder.cs @@ -46,7 +46,7 @@ public class CoreConfigContextBuilder SimpleDnsItem = config.SimpleDNSItem, ProtectDomainList = [], RawDnsItem = await ConfigDbQuery.GetDNSItem(coreType), - RoutingItem = await ConfigDbManager.GetDefaultRouting(config), + RoutingItem = await ConfigDbHandler.GetDefaultRouting(config), IsWindows = Utils.IsWindows(), IsMacOS = Utils.IsMacOS(), IsLinux = Utils.IsLinux(), @@ -204,7 +204,7 @@ public class CoreConfigContextBuilder var node = nodeContext.Node; var coreType = AppManager.Instance.GetCoreType(node, node.ConfigType); - var preSocksItem = ConfigDbManager.GetPreSocksItem(config, node, coreType); + var preSocksItem = ConfigDbHandler.GetPreSocksItem(config, node, coreType); if (preSocksItem != null) { var preSocksResult = await Build(nodeContext.AppConfig, preSocksItem); diff --git a/v2rayN/ServiceLib/Handler/ConnectionHandler.cs b/v2rayN/ServiceLib/Handler/ConnectionHandler.cs index 67e9c83d..d9c1d2b8 100644 --- a/v2rayN/ServiceLib/Handler/ConnectionHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConnectionHandler.cs @@ -79,7 +79,7 @@ public static class ConnectionHandler public static async Task GetRealPingTime(HttpClient client, CancellationToken cancellationToken = default) { - var url = ConfigTextManager.Config.SpeedTestItem.SpeedPingTestUrl; + var url = ConfigTextHandler.Config.SpeedTestItem.SpeedPingTestUrl; var responseTime = -1; try { @@ -114,7 +114,7 @@ public static class ConnectionHandler { try { - var url = ConfigTextManager.Config.SpeedTestItem.IPAPIUrl; + var url = ConfigTextHandler.Config.SpeedTestItem.IPAPIUrl; if (url.IsNullOrEmpty()) { return null; diff --git a/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs b/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs index ba149e1e..c1300053 100644 --- a/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs @@ -9,7 +9,7 @@ public static class CoreConfigHandler public static async Task GenerateClientConfig(CoreConfigContext context, string? fileName) { - var config = ConfigTextManager.Config; + var config = ConfigTextHandler.Config; var result = new RetResult(); var node = context.Node; diff --git a/v2rayN/ServiceLib/Manager/Data/ConfigDbManager.cs b/v2rayN/ServiceLib/Handler/Data/ConfigDbHandler.cs similarity index 99% rename from v2rayN/ServiceLib/Manager/Data/ConfigDbManager.cs rename to v2rayN/ServiceLib/Handler/Data/ConfigDbHandler.cs index 37508735..5f9f8297 100644 --- a/v2rayN/ServiceLib/Manager/Data/ConfigDbManager.cs +++ b/v2rayN/ServiceLib/Handler/Data/ConfigDbHandler.cs @@ -1,14 +1,14 @@ -namespace ServiceLib.Manager.Data; +namespace ServiceLib.Handler.Data; -public static class ConfigDbManager +public static class ConfigDbHandler { - private static readonly string _tag = "ConfigDbManager"; + private static readonly string _tag = "ConfigDbHandler"; private static Config CurrentConfig => ConfigState.Instance.Current; private static async Task SaveConfig() { - return await ConfigTextManager.SaveConfig(); + return await ConfigTextHandler.SaveConfig(); } #region Server @@ -2011,7 +2011,7 @@ public static class ConfigDbManager var existItem = FindMatchedProfileItem(lstSub, activeProfile); if (existItem != null) { - await ConfigDbManager.SetDefaultServerIndex(config, existItem.IndexId); + await ConfigDbHandler.SetDefaultServerIndex(config, existItem.IndexId); } } @@ -2504,7 +2504,7 @@ public static class ConfigDbManager var lockItem = items?.FirstOrDefault(t => t.Locked == true); if (lockItem != null) { - await ConfigDbManager.RemoveRoutingItem(lockItem); + await ConfigDbHandler.RemoveRoutingItem(lockItem); items = await ConfigDbQuery.RoutingItems(); } @@ -3009,7 +3009,7 @@ public static class ConfigDbManager private static async Task MigrateProfileExtraV2ToV3Sub(List batch) { var updateProfileItems = new List(); - var config = ConfigTextManager.Config; + var config = ConfigTextHandler.Config; foreach (var item in batch) { diff --git a/v2rayN/ServiceLib/Manager/Data/ConfigDbQuery.cs b/v2rayN/ServiceLib/Handler/Data/ConfigDbQuery.cs similarity index 99% rename from v2rayN/ServiceLib/Manager/Data/ConfigDbQuery.cs rename to v2rayN/ServiceLib/Handler/Data/ConfigDbQuery.cs index d0a9a5bf..b3e69b64 100644 --- a/v2rayN/ServiceLib/Manager/Data/ConfigDbQuery.cs +++ b/v2rayN/ServiceLib/Handler/Data/ConfigDbQuery.cs @@ -1,4 +1,4 @@ -namespace ServiceLib.Manager.Data; +namespace ServiceLib.Handler.Data; public class ConfigDbQuery { diff --git a/v2rayN/ServiceLib/Manager/Data/ConfigState.cs b/v2rayN/ServiceLib/Handler/Data/ConfigState.cs similarity index 95% rename from v2rayN/ServiceLib/Manager/Data/ConfigState.cs rename to v2rayN/ServiceLib/Handler/Data/ConfigState.cs index 0b9ac54d..824ea296 100644 --- a/v2rayN/ServiceLib/Manager/Data/ConfigState.cs +++ b/v2rayN/ServiceLib/Handler/Data/ConfigState.cs @@ -1,4 +1,4 @@ -namespace ServiceLib.Manager.Data; +namespace ServiceLib.Handler.Data; public sealed class ConfigState { diff --git a/v2rayN/ServiceLib/Manager/Data/ConfigTextManager.cs b/v2rayN/ServiceLib/Handler/Data/ConfigTextHandler.cs similarity index 97% rename from v2rayN/ServiceLib/Manager/Data/ConfigTextManager.cs rename to v2rayN/ServiceLib/Handler/Data/ConfigTextHandler.cs index cc47552a..b204ed05 100644 --- a/v2rayN/ServiceLib/Manager/Data/ConfigTextManager.cs +++ b/v2rayN/ServiceLib/Handler/Data/ConfigTextHandler.cs @@ -1,9 +1,9 @@ -namespace ServiceLib.Manager.Data; +namespace ServiceLib.Handler.Data; -public static class ConfigTextManager +public static class ConfigTextHandler { private static readonly string _configRes = Global.ConfigFileName; - private static readonly string _tag = "ConfigTextManager"; + private static readonly string _tag = "ConfigTextHandler"; public static Config Config { @@ -145,7 +145,7 @@ public static class ConfigTextManager config.ConstItem ??= new ConstItem(); - config.SimpleDNSItem ??= ConfigDbManager.InitBuiltinSimpleDNS(); + config.SimpleDNSItem ??= ConfigDbHandler.InitBuiltinSimpleDNS(); config.SimpleDNSItem.BlockAAAAQuery ??= false; config.SimpleDNSItem.FakeIPRange ??= Global.FakeIPRanges.FirstOrDefault(); config.SimpleDNSItem.FakeIPv6 ??= false; diff --git a/v2rayN/ServiceLib/Handler/SubscriptionHandler.cs b/v2rayN/ServiceLib/Handler/SubscriptionHandler.cs index 58721ec7..36832725 100644 --- a/v2rayN/ServiceLib/Handler/SubscriptionHandler.cs +++ b/v2rayN/ServiceLib/Handler/SubscriptionHandler.cs @@ -106,7 +106,7 @@ public class SubscriptionHandler( await updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgStartParsingSubscription}"); // Add servers to configuration - var ret = await ConfigDbManager.AddBatchServers(_config, result, id, true); + var ret = await ConfigDbHandler.AddBatchServers(_config, result, id, true); if (ret <= 0) { Logging.SaveLog("FailedImportSubscription"); diff --git a/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingLinux.cs b/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingLinux.cs index 57238357..6a818b55 100644 --- a/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingLinux.cs +++ b/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingLinux.cs @@ -19,7 +19,7 @@ public static class ProxySettingLinux private static async Task ExecCmd(List args) { - var customSystemProxyScriptPath = ConfigTextManager.Config.SystemProxyItem?.CustomSystemProxyScriptPath; + var customSystemProxyScriptPath = ConfigTextHandler.Config.SystemProxyItem?.CustomSystemProxyScriptPath; var fileName = (customSystemProxyScriptPath.IsNotEmpty() && File.Exists(customSystemProxyScriptPath)) ? customSystemProxyScriptPath : await FileUtils.CreateLinuxShellFile(_proxySetFileName, EmbedUtils.GetEmbedText(Global.ProxySetLinuxShellFileName), false); diff --git a/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingOSX.cs b/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingOSX.cs index 04b510b0..9151a6df 100644 --- a/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingOSX.cs +++ b/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingOSX.cs @@ -24,7 +24,7 @@ public static class ProxySettingOSX private static async Task ExecCmd(List args) { - var customSystemProxyScriptPath = ConfigTextManager.Config.SystemProxyItem?.CustomSystemProxyScriptPath; + var customSystemProxyScriptPath = ConfigTextHandler.Config.SystemProxyItem?.CustomSystemProxyScriptPath; var fileName = (customSystemProxyScriptPath.IsNotEmpty() && File.Exists(customSystemProxyScriptPath)) ? customSystemProxyScriptPath : await FileUtils.CreateLinuxShellFile(_proxySetFileName, EmbedUtils.GetEmbedText(Global.ProxySetOSXShellFileName), false); diff --git a/v2rayN/ServiceLib/Manager/AppManager.cs b/v2rayN/ServiceLib/Manager/AppManager.cs index 25d6efd2..8c99a85f 100644 --- a/v2rayN/ServiceLib/Manager/AppManager.cs +++ b/v2rayN/ServiceLib/Manager/AppManager.cs @@ -67,7 +67,7 @@ public sealed class AppManager } Logging.Setup(); - _config = ConfigTextManager.Init(); + _config = ConfigTextHandler.Init(); if (_config == null) { return false; @@ -104,7 +104,7 @@ public sealed class AppManager Task.Run(async () => { - await ConfigDbManager.MigrateProfileExtra(); + await ConfigDbHandler.MigrateProfileExtra(); }).Wait(); return true; @@ -127,7 +127,7 @@ public sealed class AppManager AppEvents.AppExitRequested.Publish(); await Task.Delay(50); //Wait for AppExitRequested to be processed - await ConfigTextManager.SaveConfig(); + await ConfigTextHandler.SaveConfig(); await ProfileExManager.Instance.SaveTo(); await StatisticsManager.Instance.SaveTo(); await CoreManager.Instance.CoreStop(); diff --git a/v2rayN/ServiceLib/Manager/ClashApiManager.cs b/v2rayN/ServiceLib/Manager/ClashApiManager.cs index b466a037..b7c54d04 100644 --- a/v2rayN/ServiceLib/Manager/ClashApiManager.cs +++ b/v2rayN/ServiceLib/Manager/ClashApiManager.cs @@ -82,7 +82,7 @@ public sealed class ClashApiManager private async Task TestProxyDelay(string name) { var url = $"{ApiUrl}/proxies/{Utils.UrlEncode(name)}/delay?timeout=10000&url=" + - Utils.UrlEncode(ConfigTextManager.Config.SpeedTestItem.SpeedPingTestUrl); + Utils.UrlEncode(ConfigTextHandler.Config.SpeedTestItem.SpeedPingTestUrl); return await SendTestRequest(url); } @@ -90,7 +90,7 @@ public sealed class ClashApiManager { var url = $"{ApiUrl}/providers/proxies/{Utils.UrlEncode(providerName)}/{Utils.UrlEncode(name)}/healthcheck?timeout=10000&url=" + - Utils.UrlEncode(ConfigTextManager.Config.SpeedTestItem.SpeedPingTestUrl); + Utils.UrlEncode(ConfigTextHandler.Config.SpeedTestItem.SpeedPingTestUrl); return await SendTestRequest(url); } diff --git a/v2rayN/ServiceLib/Manager/PacManager.cs b/v2rayN/ServiceLib/Manager/PacManager.cs index 20890a75..3450be6a 100644 --- a/v2rayN/ServiceLib/Manager/PacManager.cs +++ b/v2rayN/ServiceLib/Manager/PacManager.cs @@ -31,7 +31,7 @@ public class PacManager private async Task InitText(int httpPort) { - var customSystemProxyPacPath = ConfigTextManager.Config.SystemProxyItem.CustomSystemProxyPacPath; + var customSystemProxyPacPath = ConfigTextHandler.Config.SystemProxyItem.CustomSystemProxyPacPath; var fileName = customSystemProxyPacPath.IsNotEmpty() && File.Exists(customSystemProxyPacPath) ? customSystemProxyPacPath : Path.Combine(Utils.GetConfigPath(), "pac.txt"); diff --git a/v2rayN/ServiceLib/Manager/Data/ProfileExManager.cs b/v2rayN/ServiceLib/Manager/ProfileExManager.cs similarity index 99% rename from v2rayN/ServiceLib/Manager/Data/ProfileExManager.cs rename to v2rayN/ServiceLib/Manager/ProfileExManager.cs index beed2734..1c361716 100644 --- a/v2rayN/ServiceLib/Manager/Data/ProfileExManager.cs +++ b/v2rayN/ServiceLib/Manager/ProfileExManager.cs @@ -1,4 +1,4 @@ -namespace ServiceLib.Manager.Data; +namespace ServiceLib.Manager; public class ProfileExManager { diff --git a/v2rayN/ServiceLib/Manager/TaskManager.cs b/v2rayN/ServiceLib/Manager/TaskManager.cs index b5e233a3..d3672b19 100644 --- a/v2rayN/ServiceLib/Manager/TaskManager.cs +++ b/v2rayN/ServiceLib/Manager/TaskManager.cs @@ -42,7 +42,7 @@ public class TaskManager try { - await ConfigTextManager.SaveConfig(); + await ConfigTextHandler.SaveConfig(); await ProfileExManager.Instance.SaveTo(); } catch (Exception ex) @@ -113,7 +113,7 @@ public class TaskManager }); await handler.UpdateProcess(item.Id); item.UpdateTime = updateTime; - await ConfigDbManager.AddSubItem(_config, item); + await ConfigDbHandler.AddSubItem(_config, item); await Task.Delay(1000); } } diff --git a/v2rayN/ServiceLib/Manager/WebDavManager.cs b/v2rayN/ServiceLib/Manager/WebDavManager.cs index f9f0ae4f..2c89b88d 100644 --- a/v2rayN/ServiceLib/Manager/WebDavManager.cs +++ b/v2rayN/ServiceLib/Manager/WebDavManager.cs @@ -16,7 +16,7 @@ public sealed class WebDavManager public WebDavManager() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; } private async Task GetClient() diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayBalancerService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayBalancerService.cs index 846a3a80..6ba45f44 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayBalancerService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayBalancerService.cs @@ -47,7 +47,7 @@ public partial class CoreConfigV2rayService subjectSelector = [baseTagName], pingConfig = new() { - destination = ConfigTextManager.Config.SpeedTestItem.SpeedPingTestUrl, + destination = ConfigTextHandler.Config.SpeedTestItem.SpeedPingTestUrl, interval = "5m", timeout = "30s", sampling = 2, @@ -68,7 +68,7 @@ public partial class CoreConfigV2rayService _coreConfig.observatory = new Observatory4Ray { subjectSelector = [baseTagName], - probeUrl = ConfigTextManager.Config.SpeedTestItem.SpeedPingTestUrl, + probeUrl = ConfigTextHandler.Config.SpeedTestItem.SpeedPingTestUrl, probeInterval = "3m", enableConcurrency = true, }; diff --git a/v2rayN/ServiceLib/ViewModels/AddGroupServerViewModel.cs b/v2rayN/ServiceLib/ViewModels/AddGroupServerViewModel.cs index 6d08cfe8..d89bcf0d 100644 --- a/v2rayN/ServiceLib/ViewModels/AddGroupServerViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/AddGroupServerViewModel.cs @@ -43,7 +43,7 @@ public partial class AddGroupServerViewModel : MyReactiveObject, ICloseable public AddGroupServerViewModel(ProfileItem profileItem) { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; var canEditRemove = this.WhenAnyValue( x => x.SelectedChild, @@ -245,7 +245,7 @@ public partial class AddGroupServerViewModel : MyReactiveObject, ICloseable SelectedSource.SetProtocolExtra(protocolExtra); - if (await ConfigDbManager.AddServerCommon(_config, SelectedSource) == 0) + if (await ConfigDbHandler.AddServerCommon(_config, SelectedSource) == 0) { NoticeManager.Instance.Enqueue(ResUI.OperationSuccess); RequestClose?.Invoke(this, EventArgs.Empty); diff --git a/v2rayN/ServiceLib/ViewModels/AddServer2ViewModel.cs b/v2rayN/ServiceLib/ViewModels/AddServer2ViewModel.cs index 9987ba9f..916941fd 100644 --- a/v2rayN/ServiceLib/ViewModels/AddServer2ViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/AddServer2ViewModel.cs @@ -24,7 +24,7 @@ public partial class AddServer2ViewModel : MyReactiveObject, ICloseable public AddServer2ViewModel(ProfileItem profileItem) { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; BrowseServerCmd = ReactiveCommand.CreateFromTask(async () => { @@ -71,7 +71,7 @@ public partial class AddServer2ViewModel : MyReactiveObject, ICloseable IsSingboxEndpoint = IsSingboxEndpoint ? true : null, }); - if (await ConfigDbManager.EditCustomServer(_config, SelectedSource) == 0) + if (await ConfigDbHandler.EditCustomServer(_config, SelectedSource) == 0) { NoticeManager.Instance.Enqueue(ResUI.OperationSuccess); RequestClose?.Invoke(this, EventArgs.Empty); @@ -92,7 +92,7 @@ public partial class AddServer2ViewModel : MyReactiveObject, ICloseable var item = await ConfigDbQuery.GetProfileItem(SelectedSource.IndexId); item ??= SelectedSource; item.Address = fileName; - var result = item.ConfigType == EConfigType.Outbound ? await ConfigDbManager.AddCustomOutboundServer(_config, item, false) : await ConfigDbManager.AddCustomServer(_config, item, false); + var result = item.ConfigType == EConfigType.Outbound ? await ConfigDbHandler.AddCustomOutboundServer(_config, item, false) : await ConfigDbHandler.AddCustomServer(_config, item, false); if (result == 0) { NoticeManager.Instance.Enqueue(ResUI.SuccessfullyImportedCustomServer); diff --git a/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs b/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs index 35a9e802..dc864902 100644 --- a/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs @@ -319,7 +319,7 @@ public partial class AddServerViewModel : MyReactiveObject, ICloseable public AddServerViewModel(ProfileItem profileItem) { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; FetchCertCmd = ReactiveCommand.CreateFromTask(async () => { @@ -594,7 +594,7 @@ public partial class AddServerViewModel : MyReactiveObject, ICloseable }); SelectedSource.SetTransportExtra(transport); - if (await ConfigDbManager.AddServer(_config, SelectedSource) == 0) + if (await ConfigDbHandler.AddServer(_config, SelectedSource) == 0) { NoticeManager.Instance.Enqueue(ResUI.OperationSuccess); RequestClose?.Invoke(this, EventArgs.Empty); diff --git a/v2rayN/ServiceLib/ViewModels/BackupAndRestoreViewModel.cs b/v2rayN/ServiceLib/ViewModels/BackupAndRestoreViewModel.cs index 56b71000..8b6f3094 100644 --- a/v2rayN/ServiceLib/ViewModels/BackupAndRestoreViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/BackupAndRestoreViewModel.cs @@ -19,7 +19,7 @@ public partial class BackupAndRestoreViewModel : MyReactiveObject public BackupAndRestoreViewModel() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; WebDavCheckCmd = ReactiveCommand.CreateFromTask(async () => { @@ -46,7 +46,7 @@ public partial class BackupAndRestoreViewModel : MyReactiveObject { DisplayOperationMsg(); _config.WebDavItem = SelectedSource; - _ = await ConfigTextManager.SaveConfig(); + _ = await ConfigTextHandler.SaveConfig(); var result = await WebDavManager.Instance.CheckConnection(); if (result) diff --git a/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs b/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs index e8adfe48..2b58028e 100644 --- a/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs @@ -19,7 +19,7 @@ public partial class CheckUpdateViewModel : MyReactiveObject public CheckUpdateViewModel() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; CheckUpdateCmd = ReactiveCommand.CreateFromTask(CheckUpdate); CheckUpdateCmd.ThrownExceptions.Subscribe(ex => @@ -126,7 +126,7 @@ public partial class CheckUpdateViewModel : MyReactiveObject .Select(t => t.CoreTypeForStorage) .ToList(); - await ConfigTextManager.SaveConfig(); + await ConfigTextHandler.SaveConfig(); } private async Task CheckOnly() diff --git a/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs b/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs index 4f0a479e..7fedb04e 100644 --- a/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs @@ -4,7 +4,7 @@ public partial class ClashConnectionsViewModel : MyReactiveObject { public ClashConnectionsViewModel() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; AutoRefresh = _config.ClashUIItem.ConnectionsAutoRefresh; var canEditRemove = this.WhenAnyValue( diff --git a/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs b/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs index 6adcdcbf..09686bb0 100644 --- a/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs @@ -7,7 +7,7 @@ public partial class ClashProxiesViewModel : MyReactiveObject public ClashProxiesViewModel() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; ProxiesReloadCmd = ReactiveCommand.CreateFromTask(async () => { diff --git a/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs index 8898b302..a9248400 100644 --- a/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs @@ -48,7 +48,7 @@ public partial class DNSSettingViewModel : MyReactiveObject, ICloseable public DNSSettingViewModel() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; SaveCmd = ReactiveCommand.CreateFromTask(SaveSettingAsync); ImportDefConfig4V2rayCompatibleCmd = ReactiveCommand.CreateFromTask(async () => @@ -82,7 +82,7 @@ public partial class DNSSettingViewModel : MyReactiveObject, ICloseable private async Task Init() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; var item = _config.SimpleDNSItem; UseSystemHosts = item.UseSystemHosts ?? false; AddCommonHosts = item.AddCommonHosts ?? false; @@ -207,7 +207,7 @@ public partial class DNSSettingViewModel : MyReactiveObject, ICloseable item1.UseSystemHosts = UseSystemHostsCompatible; item1.NormalDNS = NormalDNSCompatible; item1.TunDNS = TunDNSCompatible; - await ConfigDbManager.SaveDNSItems(_config, item1); + await ConfigDbHandler.SaveDNSItems(_config, item1); var item2 = await ConfigDbQuery.GetDNSItem(ECoreType.sing_box); item2.Enabled = SBCustomDNSEnableCompatible; @@ -215,9 +215,9 @@ public partial class DNSSettingViewModel : MyReactiveObject, ICloseable item2.DomainDNSAddress = DomainDNSAddress2Compatible; item2.NormalDNS = JsonUtils.Serialize(JsonUtils.Deserialize(NormalDNS2Compatible)); item2.TunDNS = JsonUtils.Serialize(JsonUtils.Deserialize(TunDNS2Compatible)); - await ConfigDbManager.SaveDNSItems(_config, item2); + await ConfigDbHandler.SaveDNSItems(_config, item2); - await ConfigTextManager.SaveConfig(); + await ConfigTextHandler.SaveConfig(); RequestClose?.Invoke(this, EventArgs.Empty); } } diff --git a/v2rayN/ServiceLib/ViewModels/FullConfigTemplateViewModel.cs b/v2rayN/ServiceLib/ViewModels/FullConfigTemplateViewModel.cs index e3af4f63..9a79aa58 100644 --- a/v2rayN/ServiceLib/ViewModels/FullConfigTemplateViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/FullConfigTemplateViewModel.cs @@ -44,7 +44,7 @@ public partial class FullConfigTemplateViewModel : MyReactiveObject, ICloseable public FullConfigTemplateViewModel() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; SaveCmd = ReactiveCommand.CreateFromTask(async () => { await SaveSettingAsync(); @@ -104,7 +104,7 @@ public partial class FullConfigTemplateViewModel : MyReactiveObject, ICloseable item.AddProxyOnly = AddProxyOnly4Ray; item.ProxyDetour = ProxyDetour4Ray; - await ConfigDbManager.SaveFullConfigTemplate(_config, item); + await ConfigDbHandler.SaveFullConfigTemplate(_config, item); return true; } @@ -122,7 +122,7 @@ public partial class FullConfigTemplateViewModel : MyReactiveObject, ICloseable item.AddProxyOnly = AddProxyOnly4Singbox; item.ProxyDetour = ProxyDetour4Singbox; - await ConfigDbManager.SaveFullConfigTemplate(_config, item); + await ConfigDbHandler.SaveFullConfigTemplate(_config, item); return true; } } diff --git a/v2rayN/ServiceLib/ViewModels/GlobalHotkeySettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/GlobalHotkeySettingViewModel.cs index 2edd79d4..8438731f 100644 --- a/v2rayN/ServiceLib/ViewModels/GlobalHotkeySettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/GlobalHotkeySettingViewModel.cs @@ -12,7 +12,7 @@ public class GlobalHotkeySettingViewModel : MyReactiveObject, ICloseable public GlobalHotkeySettingViewModel() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; _globalHotkeys = JsonUtils.DeepCopy(_config.GlobalHotkeys); @@ -52,7 +52,7 @@ public class GlobalHotkeySettingViewModel : MyReactiveObject, ICloseable { _config.GlobalHotkeys = _globalHotkeys; - if (await ConfigTextManager.SaveConfig() == 0) + if (await ConfigTextHandler.SaveConfig() == 0) { RequestClose?.Invoke(this, EventArgs.Empty); } diff --git a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs index 6aa2f18f..a29eceff 100644 --- a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs @@ -90,7 +90,7 @@ public partial class MainWindowViewModel : MyReactiveObject public MainWindowViewModel() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; BlIsWindows = Utils.IsWindows(); MainGirdOrientation = _config.UiItem.MainGirdOrientation; @@ -331,8 +331,8 @@ public partial class MainWindowViewModel : MyReactiveObject } //await ConfigHandler.InitBuiltinRouting(_config); - await ConfigDbManager.InitBuiltinDNS(_config); - await ConfigDbManager.InitBuiltinFullConfigTemplate(_config); + await ConfigDbHandler.InitBuiltinDNS(_config); + await ConfigDbHandler.InitBuiltinFullConfigTemplate(_config); await ProfileExManager.Instance.Init(); await CoreManager.Instance.Init(_config, UpdateHandler); await CertPemManager.Instance.Init(_config); @@ -499,7 +499,7 @@ public partial class MainWindowViewModel : MyReactiveObject } stringData = result; } - var ret = await ConfigDbManager.AddBatchServers(_config, stringData, _config.SubIndexId, false); + var ret = await ConfigDbHandler.AddBatchServers(_config, stringData, _config.SubIndexId, false); if (ret > 0) { await RefreshSubscriptions(); @@ -549,7 +549,7 @@ public partial class MainWindowViewModel : MyReactiveObject } else { - var ret = await ConfigDbManager.AddBatchServers(_config, result, _config.SubIndexId, false); + var ret = await ConfigDbHandler.AddBatchServers(_config, result, _config.SubIndexId, false); if (ret > 0) { await RefreshSubscriptions(); @@ -610,7 +610,7 @@ public partial class MainWindowViewModel : MyReactiveObject var ret = await AppManager.Instance.WindowDialog.ShowDialogAsync(routingSettingViewModel); if (ret == true) { - await ConfigDbManager.InitBuiltinRouting(_config); + await ConfigDbHandler.InitBuiltinRouting(_config); RxSchedulers.MainThreadScheduler.Schedule(async () => { await StatusBarViewModel.RefreshRoutingsMenu(); @@ -696,7 +696,7 @@ public partial class MainWindowViewModel : MyReactiveObject TabMainSelectedIndex = 0; } }); - var profileItem = await ConfigDbManager.GetDefaultServer(_config); + var profileItem = await ConfigDbHandler.GetDefaultServer(_config); if (profileItem == null) { NoticeManager.Instance.Enqueue(ResUI.CheckServerSettings); @@ -788,14 +788,14 @@ public partial class MainWindowViewModel : MyReactiveObject public async Task ApplyRegionalPreset(EPresetType type) { - await ConfigDbManager.ApplyRegionalPreset(_config, type); - await ConfigDbManager.InitRouting(_config); + await ConfigDbHandler.ApplyRegionalPreset(_config, type); + await ConfigDbHandler.InitRouting(_config); RxSchedulers.MainThreadScheduler.Schedule(async () => { await StatusBarViewModel.RefreshRoutingsMenu(); }); - await ConfigTextManager.SaveConfig(); + await ConfigTextHandler.SaveConfig(); using var downloadService = await DownloadService.CreateDownloadServiceWithCheck(); await new UpdateService(downloadService, _config, UpdateTaskHandler).UpdateGeoFileAll(); await Reload(); diff --git a/v2rayN/ServiceLib/ViewModels/MsgViewModel.cs b/v2rayN/ServiceLib/ViewModels/MsgViewModel.cs index 22a04e73..c2ad7826 100644 --- a/v2rayN/ServiceLib/ViewModels/MsgViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/MsgViewModel.cs @@ -16,7 +16,7 @@ public partial class MsgViewModel : MyReactiveObject public MsgViewModel() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; MsgFilter = _config.MsgUIItem.MainMsgFilter ?? string.Empty; AutoRefresh = _config.MsgUIItem.AutoRefresh ?? true; diff --git a/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs index 62f53e8e..b6ee9a26 100644 --- a/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs @@ -124,7 +124,7 @@ public partial class OptionSettingViewModel : MyReactiveObject, ICloseable public OptionSettingViewModel() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; BlIsWindows = Utils.IsWindows(); BlIsLinux = Utils.IsLinux(); BlIsIsMacOS = Utils.IsMacOS(); @@ -407,7 +407,7 @@ public partial class OptionSettingViewModel : MyReactiveObject, ICloseable //coreType await SaveCoreType(); - if (await ConfigTextManager.SaveConfig() == 0) + if (await ConfigTextHandler.SaveConfig() == 0) { await AutoStartupHandler.UpdateTask(_config); AppManager.Instance.Reset(); diff --git a/v2rayN/ServiceLib/ViewModels/ProfilesSelectViewModel.cs b/v2rayN/ServiceLib/ViewModels/ProfilesSelectViewModel.cs index 40aca65e..bbfb75ab 100644 --- a/v2rayN/ServiceLib/ViewModels/ProfilesSelectViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ProfilesSelectViewModel.cs @@ -51,7 +51,7 @@ public partial class ProfilesSelectViewModel : MyReactiveObject, ICloseable public ProfilesSelectViewModel() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; _subIndexId = _config.SubIndexId ?? string.Empty; #region WhenAnyValue && ReactiveCommand diff --git a/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs b/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs index 85275e4f..49eca757 100644 --- a/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs @@ -96,7 +96,7 @@ public partial class ProfilesViewModel : MyReactiveObject public ProfilesViewModel() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; #region WhenAnyValue && ReactiveCommand @@ -401,7 +401,7 @@ public partial class ProfilesViewModel : MyReactiveObject { var lstModel = await ConfigDbQuery.ProfileModels(_config.SubIndexId, filter); - await ConfigDbManager.SetDefaultServer(_config, lstModel); + await ConfigDbHandler.SetDefaultServer(_config, lstModel); var lstServerStat = (_config.GuiItem.EnableStatistics ? StatisticsManager.Instance.ServerStat : null) ?? []; var lstProfileExs = await ProfileExManager.Instance.GetProfileExs(); @@ -516,7 +516,7 @@ public partial class ProfilesViewModel : MyReactiveObject } var exists = lstSelected.Exists(t => t.IndexId == _config.IndexId); - await ConfigDbManager.RemoveServers(_config, lstSelected); + await ConfigDbHandler.RemoveServers(_config, lstSelected); NoticeManager.Instance.Enqueue(ResUI.OperationSuccess); if (lstSelected.Count == ProfileItems.Count) { @@ -536,7 +536,7 @@ public partial class ProfilesViewModel : MyReactiveObject return; } - var tuple = await ConfigDbManager.DedupServerList(_config, _config.SubIndexId); + var tuple = await ConfigDbHandler.DedupServerList(_config, _config.SubIndexId); if (tuple.Item1 > 0 || tuple.Item2 > 0) { await RefreshServers(); @@ -552,7 +552,7 @@ public partial class ProfilesViewModel : MyReactiveObject { return; } - if (await ConfigDbManager.CopyServer(_config, lstSelected) == 0) + if (await ConfigDbHandler.CopyServer(_config, lstSelected) == 0) { await RefreshServers(); NoticeManager.Instance.Enqueue(ResUI.OperationSuccess); @@ -585,7 +585,7 @@ public partial class ProfilesViewModel : MyReactiveObject return; } - if (await ConfigDbManager.SetDefaultServerIndex(_config, indexId) == 0) + if (await ConfigDbHandler.SetDefaultServerIndex(_config, indexId) == 0) { await RefreshServers(); Reload(); @@ -611,7 +611,7 @@ public partial class ProfilesViewModel : MyReactiveObject private async Task GenGroupAllServer() { - var ret = await ConfigDbManager.AddGroupAllServer(_config, SelectedSub); + var ret = await ConfigDbHandler.AddGroupAllServer(_config, SelectedSub); if (ret.Success != true) { NoticeManager.Instance.Enqueue(ResUI.OperationFailed); @@ -623,7 +623,7 @@ public partial class ProfilesViewModel : MyReactiveObject private async Task GenGroupRegionServer() { - var ret = await ConfigDbManager.AddGroupRegionServer(_config, SelectedSub); + var ret = await ConfigDbHandler.AddGroupRegionServer(_config, SelectedSub); if (ret.Success != true) { NoticeManager.Instance.Enqueue(ResUI.OperationFailed); @@ -643,7 +643,7 @@ public partial class ProfilesViewModel : MyReactiveObject _dicHeaderSort.TryAdd(colName, true); _dicHeaderSort.TryGetValue(colName, out var asc); - if (await ConfigDbManager.SortServers(_config, _config.SubIndexId, colName, asc) != 0) + if (await ConfigDbHandler.SortServers(_config, _config.SubIndexId, colName, asc) != 0) { return; } @@ -653,7 +653,7 @@ public partial class ProfilesViewModel : MyReactiveObject public async Task RemoveInvalidServerResult() { - var count = await ConfigDbManager.RemoveInvalidServerResult(_config, _config.SubIndexId); + var count = await ConfigDbHandler.RemoveInvalidServerResult(_config, _config.SubIndexId); await RefreshServers(); NoticeManager.Instance.Enqueue(string.Format(ResUI.RemoveInvalidServerResultTip, count)); } @@ -667,7 +667,7 @@ public partial class ProfilesViewModel : MyReactiveObject return; } - await ConfigDbManager.MoveToGroup(_config, lstSelected, SelectedMoveToGroup.Id); + await ConfigDbHandler.MoveToGroup(_config, lstSelected, SelectedMoveToGroup.Id); NoticeManager.Instance.Enqueue(ResUI.OperationSuccess); await RefreshServers(); @@ -685,7 +685,7 @@ public partial class ProfilesViewModel : MyReactiveObject return; } - if (await ConfigDbManager.MoveServer(_config, lstProfile, index, eMove) == 0) + if (await ConfigDbHandler.MoveServer(_config, lstProfile, index, eMove) == 0) { await RefreshServers(); } @@ -697,7 +697,7 @@ public partial class ProfilesViewModel : MyReactiveObject if (startIndex >= 0 && targetIndex >= 0 && startIndex != targetIndex) { var lstProfile = ProfileItems?.Select(t => t.IndexId).ToList() ?? []; - if (await ConfigDbManager.MoveServer(_config, lstProfile, startIndex, EMove.Position, targetIndex) == 0) + if (await ConfigDbHandler.MoveServer(_config, lstProfile, startIndex, EMove.Position, targetIndex) == 0) { await RefreshServers(); } @@ -719,7 +719,7 @@ public partial class ProfilesViewModel : MyReactiveObject .Select(item => item.IndexId) .ToList(); - var result = await ConfigDbManager.MoveServersTo( + var result = await ConfigDbHandler.MoveServersTo( _config, orderedProfileIds, sourceIndices, @@ -923,7 +923,7 @@ public partial class ProfilesViewModel : MyReactiveObject { return; } - await ConfigDbManager.DeleteSubItem(_config, item.Id); + await ConfigDbHandler.DeleteSubItem(_config, item.Id); await RefreshSubscriptions(); await SubSelectedChangedAsync(); diff --git a/v2rayN/ServiceLib/ViewModels/RoutingRuleDetailsViewModel.cs b/v2rayN/ServiceLib/ViewModels/RoutingRuleDetailsViewModel.cs index 2179fe07..333da75c 100644 --- a/v2rayN/ServiceLib/ViewModels/RoutingRuleDetailsViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/RoutingRuleDetailsViewModel.cs @@ -45,7 +45,7 @@ public partial class RoutingRuleDetailsViewModel : MyReactiveObject, ICloseable public RoutingRuleDetailsViewModel(RulesItem rulesItem) { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; SelectProfileCmd = ReactiveCommand.CreateFromTask(async () => { diff --git a/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs index 70b11a71..da5add5d 100644 --- a/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs @@ -38,7 +38,7 @@ public partial class RoutingRuleSettingViewModel : MyReactiveObject, ICloseable public RoutingRuleSettingViewModel(RoutingItem routingItem) { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; var canEditRemove = this.WhenAnyValue( x => x.SelectedSource, @@ -211,7 +211,7 @@ public partial class RoutingRuleSettingViewModel : MyReactiveObject, ICloseable return; } var index = _rules.IndexOf(item); - if (await ConfigDbManager.MoveRoutingRule(_rules, index, eMove) == 0) + if (await ConfigDbHandler.MoveRoutingRule(_rules, index, eMove) == 0) { RefreshRulesItems(); } @@ -233,7 +233,7 @@ public partial class RoutingRuleSettingViewModel : MyReactiveObject, ICloseable item.RuleNum = _rules.Count; item.RuleSet = JsonUtils.Serialize(_rules, false); - if (await ConfigDbManager.SaveRoutingItem(_config, item) == 0) + if (await ConfigDbHandler.SaveRoutingItem(_config, item) == 0) { NoticeManager.Instance.Enqueue(ResUI.OperationSuccess); RequestClose?.Invoke(this, EventArgs.Empty); diff --git a/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs index 16dc8c81..b45bdb4a 100644 --- a/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs @@ -32,7 +32,7 @@ public partial class RoutingSettingViewModel : MyReactiveObject public RoutingSettingViewModel() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; var canEditRemove = this.WhenAnyValue( x => x.SelectedSource, @@ -77,7 +77,7 @@ public partial class RoutingSettingViewModel : MyReactiveObject DomainStrategy = _config.RoutingBasicItem.DomainStrategy; DomainStrategy4Singbox = _config.RoutingBasicItem.DomainStrategy4Singbox; - await ConfigDbManager.InitBuiltinRouting(_config); + await ConfigDbHandler.InitBuiltinRouting(_config); await RefreshRoutingItems(); } @@ -113,7 +113,7 @@ public partial class RoutingSettingViewModel : MyReactiveObject { _config.RoutingBasicItem.DomainStrategy = DomainStrategy; _config.RoutingBasicItem.DomainStrategy4Singbox = DomainStrategy4Singbox; - await ConfigTextManager.SaveConfig(); + await ConfigTextHandler.SaveConfig(); } #endregion Refresh Save @@ -157,7 +157,7 @@ public partial class RoutingSettingViewModel : MyReactiveObject var item = await ConfigDbQuery.GetRoutingItem(it?.Id); if (item != null) { - await ConfigDbManager.RemoveRoutingItem(item); + await ConfigDbHandler.RemoveRoutingItem(item); } } @@ -174,7 +174,7 @@ public partial class RoutingSettingViewModel : MyReactiveObject return; } - if (await ConfigDbManager.SetDefaultRouting(_config, item) == 0) + if (await ConfigDbHandler.SetDefaultRouting(_config, item) == 0) { await RefreshRoutingItems(); IsModified = true; @@ -183,7 +183,7 @@ public partial class RoutingSettingViewModel : MyReactiveObject private async Task RoutingAdvancedImportRules() { - if (await ConfigDbManager.InitRouting(_config, true) == 0) + if (await ConfigDbHandler.InitRouting(_config, true) == 0) { await RefreshRoutingItems(); IsModified = true; diff --git a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs index ff8e084d..e0f4846f 100644 --- a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs @@ -107,7 +107,7 @@ public partial class StatusBarViewModel : MyReactiveObject public StatusBarViewModel() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; SelectedRouting = new(); SelectedServer = new(); RunningServerToolTipText = GetRunningServerToolTipText("-"); @@ -218,7 +218,7 @@ public partial class StatusBarViewModel : MyReactiveObject private async Task Init() { - await ConfigDbManager.InitBuiltinRouting(_config); + await ConfigDbHandler.InitBuiltinRouting(_config); await RefreshRoutingsMenu(); await InboundDisplayStatus(); // The view refreshes its icon on initialization; interaction handlers are not registered yet. @@ -267,7 +267,7 @@ public partial class StatusBarViewModel : MyReactiveObject await RefreshServersMenu(); //display running server - var running = await ConfigDbManager.GetDefaultServer(_config); + var running = await ConfigDbHandler.GetDefaultServer(_config); if (running != null) { RunningServerDisplay = running.GetSummary(); @@ -319,7 +319,7 @@ public partial class StatusBarViewModel : MyReactiveObject public async Task TestServerAvailability() { - var item = await ConfigDbManager.GetDefaultServer(_config); + var item = await ConfigDbHandler.GetDefaultServer(_config); if (item == null) { return null; @@ -373,7 +373,7 @@ public partial class StatusBarViewModel : MyReactiveObject NoticeManager.Instance.SendMessageEx($"{ResUI.TipChangeSystemProxy} - {_config.SystemProxyItem.SysProxyType}"); SystemProxySelected = (int)_config.SystemProxyItem.SysProxyType; - await ConfigTextManager.SaveConfig(); + await ConfigTextHandler.SaveConfig(); } public async Task ChangeSystemProxyAsync(ESysProxyType type, bool blChange) @@ -413,7 +413,7 @@ public partial class StatusBarViewModel : MyReactiveObject return; } - if (await ConfigDbManager.SetDefaultRouting(_config, item) == 0) + if (await ConfigDbHandler.SetDefaultRouting(_config, item) == 0) { NoticeManager.Instance.SendMessageEx(ResUI.TipChangeRouting); ReloadRequested.Publish(); @@ -459,7 +459,7 @@ public partial class StatusBarViewModel : MyReactiveObject } } - await ConfigTextManager.SaveConfig(); + await ConfigTextHandler.SaveConfig(); ReloadRequested.Publish(); } diff --git a/v2rayN/ServiceLib/ViewModels/SubEditViewModel.cs b/v2rayN/ServiceLib/ViewModels/SubEditViewModel.cs index f50da1be..d47e3a7e 100644 --- a/v2rayN/ServiceLib/ViewModels/SubEditViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/SubEditViewModel.cs @@ -24,7 +24,7 @@ public partial class SubEditViewModel : MyReactiveObject, ICloseable public SubEditViewModel(SubItem subItem) { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; SelectPrevProfileCmd = ReactiveCommand.CreateFromTask(async () => { @@ -89,7 +89,7 @@ public partial class SubEditViewModel : MyReactiveObject, ICloseable SelectedSource.PrevProfile = PrevProfile; SelectedSource.NextProfile = NextProfile; - if (await ConfigDbManager.AddSubItem(_config, SelectedSource) == 0) + if (await ConfigDbHandler.AddSubItem(_config, SelectedSource) == 0) { NoticeManager.Instance.Enqueue(ResUI.OperationSuccess); RequestClose?.Invoke(this, EventArgs.Empty); diff --git a/v2rayN/ServiceLib/ViewModels/SubSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/SubSettingViewModel.cs index 553d719d..c657b85f 100644 --- a/v2rayN/ServiceLib/ViewModels/SubSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/SubSettingViewModel.cs @@ -22,7 +22,7 @@ public partial class SubSettingViewModel : MyReactiveObject public SubSettingViewModel() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; var canEditRemove = this.WhenAnyValue( x => x.SelectedSource, @@ -92,7 +92,7 @@ public partial class SubSettingViewModel : MyReactiveObject foreach (var it in SelectedSources ?? [SelectedSource]) { - await ConfigDbManager.DeleteSubItem(_config, it.Id); + await ConfigDbHandler.DeleteSubItem(_config, it.Id); } await RefreshSubItems(); NoticeManager.Instance.Enqueue(ResUI.OperationSuccess); diff --git a/v2rayN/v2rayN.Desktop/App.axaml.cs b/v2rayN/v2rayN.Desktop/App.axaml.cs index ee509275..84635b2b 100644 --- a/v2rayN/v2rayN.Desktop/App.axaml.cs +++ b/v2rayN/v2rayN.Desktop/App.axaml.cs @@ -65,7 +65,7 @@ public partial class App : Application return; } - if (!ConfigTextManager.Config.UiItem.MacOSShowInDock) + if (!ConfigTextHandler.Config.UiItem.MacOSShowInDock) { MacAppUtils.SetActivationPolicyAccessory(); } @@ -76,7 +76,7 @@ public partial class App : Application private static void RestoreMacOSAccessoryPolicyAfterMiniaturize(MainWindow mainWindow) { - if (ConfigTextManager.Config.UiItem.MacOSShowInDock) + if (ConfigTextHandler.Config.UiItem.MacOSShowInDock) { return; } @@ -98,7 +98,7 @@ public partial class App : Application private static void RestoreMacOSAccessoryPolicy(MainWindow mainWindow) { - if (ConfigTextManager.Config.UiItem.MacOSShowInDock || MacAppUtils.IsWindowMiniaturized(mainWindow)) + if (ConfigTextHandler.Config.UiItem.MacOSShowInDock || MacAppUtils.IsWindowMiniaturized(mainWindow)) { return; } diff --git a/v2rayN/v2rayN.Desktop/Base/WindowBase.cs b/v2rayN/v2rayN.Desktop/Base/WindowBase.cs index b81fdb7b..47879249 100644 --- a/v2rayN/v2rayN.Desktop/Base/WindowBase.cs +++ b/v2rayN/v2rayN.Desktop/Base/WindowBase.cs @@ -23,7 +23,7 @@ public class WindowBase : ReactiveWindow where TViewMode { try { - var sizeItem = ConfigTextManager.GetWindowSizeItem(GetType().Name); + var sizeItem = ConfigTextHandler.GetWindowSizeItem(GetType().Name); if (sizeItem is null) { return; @@ -55,7 +55,7 @@ public class WindowBase : ReactiveWindow where TViewMode base.OnClosed(e); try { - ConfigTextManager.SaveWindowSizeItem(GetType().Name, Width, Height); + ConfigTextHandler.SaveWindowSizeItem(GetType().Name, Width, Height); } catch { } } diff --git a/v2rayN/v2rayN.Desktop/GlobalUsings.cs b/v2rayN/v2rayN.Desktop/GlobalUsings.cs index e498e66f..e5eaf505 100644 --- a/v2rayN/v2rayN.Desktop/GlobalUsings.cs +++ b/v2rayN/v2rayN.Desktop/GlobalUsings.cs @@ -30,8 +30,8 @@ global using ServiceLib.Common; global using ServiceLib.Enums; global using ServiceLib.Events; global using ServiceLib.Handler; +global using ServiceLib.Handler.Data; global using ServiceLib.Manager; -global using ServiceLib.Manager.Data; global using ServiceLib.Models.CoreConfigs; global using ServiceLib.Models.Configs; global using ServiceLib.Models.Dto; diff --git a/v2rayN/v2rayN.Desktop/Program.cs b/v2rayN/v2rayN.Desktop/Program.cs index f0cd83b2..62d8d721 100644 --- a/v2rayN/v2rayN.Desktop/Program.cs +++ b/v2rayN/v2rayN.Desktop/Program.cs @@ -69,7 +69,7 @@ internal class Program if (OperatingSystem.IsMacOS()) { - var showInDock = Design.IsDesignMode || ConfigTextManager.Config.UiItem.MacOSShowInDock; + var showInDock = Design.IsDesignMode || ConfigTextHandler.Config.UiItem.MacOSShowInDock; builder = builder.With(new MacOSPlatformOptions { ShowInDock = showInDock }); } diff --git a/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs b/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs index a9fcdfea..2dc454db 100644 --- a/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs +++ b/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs @@ -13,7 +13,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject public ThemeSettingViewModel() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; BindingUI(); RestoreUI(); @@ -43,7 +43,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject { _config.UiItem.CurrentTheme = CurrentTheme; ModifyTheme(); - await ConfigTextManager.SaveConfig(); + await ConfigTextHandler.SaveConfig(); } }); @@ -55,7 +55,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject { _config.UiItem.CurrentFontSize = CurrentFontSize; ModifyFontSize(); - await ConfigTextManager.SaveConfig(); + await ConfigTextHandler.SaveConfig(); } }); @@ -67,7 +67,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject { _config.UiItem.CurrentLanguage = CurrentLanguage; Thread.CurrentThread.CurrentUICulture = new(CurrentLanguage); - await ConfigTextManager.SaveConfig(); + await ConfigTextHandler.SaveConfig(); NoticeManager.Instance.Enqueue(ResUI.NeedRebootTips); } }); diff --git a/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml.cs index 2efae09f..07aaa2fe 100644 --- a/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml.cs @@ -9,7 +9,7 @@ public partial class ClashConnectionsView : ReactiveUserControl { InitializeComponent(); - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; Loaded += Window_Loaded; btnCancel.Click += (s, e) => Close(); diff --git a/v2rayN/v2rayN.Desktop/Views/FullConfigTemplateWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/FullConfigTemplateWindow.axaml.cs index 0982dbb4..dd28c3d8 100644 --- a/v2rayN/v2rayN.Desktop/Views/FullConfigTemplateWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/FullConfigTemplateWindow.axaml.cs @@ -10,7 +10,7 @@ public partial class FullConfigTemplateWindow : WindowBase Close(); diff --git a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs index 5ca05fa7..0d0a6185 100644 --- a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs @@ -25,7 +25,7 @@ public partial class MainWindow : WindowBase { InitializeComponent(); - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; _manager = new WindowNotificationManager(TopLevel.GetTopLevel(this)) { MaxItems = 3, Position = NotificationPosition.TopRight }; KeyDown += MainWindow_KeyDown; @@ -396,15 +396,15 @@ public partial class MainWindow : WindowBase private void StorageUI() { - ConfigTextManager.SaveWindowSizeItem(GetType().Name, Width, Height); + ConfigTextHandler.SaveWindowSizeItem(GetType().Name, Width, Height); if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Horizontal) { - ConfigTextManager.SaveMainGirdHeight(gridMain.ColumnDefinitions[0].ActualWidth, gridMain.ColumnDefinitions[2].ActualWidth); + ConfigTextHandler.SaveMainGirdHeight(gridMain.ColumnDefinitions[0].ActualWidth, gridMain.ColumnDefinitions[2].ActualWidth); } else if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Vertical) { - ConfigTextManager.SaveMainGirdHeight(gridMain.RowDefinitions[0].ActualHeight, gridMain.RowDefinitions[2].ActualHeight); + ConfigTextHandler.SaveMainGirdHeight(gridMain.RowDefinitions[0].ActualHeight, gridMain.RowDefinitions[2].ActualHeight); } } diff --git a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs index a79c704a..7e0b7924 100644 --- a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs @@ -13,7 +13,7 @@ public partial class OptionSettingWindow : WindowBase Loaded += Window_Loaded; btnCancel.Click += (s, e) => Close(); - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; clbdestOverride.SelectionChanged += ClbdestOverride_SelectionChanged; btnBrowseCustomSystemProxyPacPath.Click += BtnBrowseCustomSystemProxyPacPath_Click; diff --git a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs index 21e6f56a..3cb3c8ee 100644 --- a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs @@ -15,7 +15,7 @@ public partial class ProfilesView : ReactiveUserControl { InitializeComponent(); - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; menuSelectAll.Click += menuSelectAll_Click; btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click; diff --git a/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs index 99c9169e..468a9c36 100644 --- a/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs @@ -11,7 +11,7 @@ public partial class StatusBarView : ReactiveUserControl { InitializeComponent(); - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; txtRunningServerDisplay.Tapped += TxtRunningServerDisplay_Tapped; txtRunningInfoDisplay.Tapped += TxtRunningServerDisplay_Tapped; diff --git a/v2rayN/v2rayN.WebAPI/GlobalUsings.cs b/v2rayN/v2rayN.WebAPI/GlobalUsings.cs index 41833d22..1cb8eecb 100644 --- a/v2rayN/v2rayN.WebAPI/GlobalUsings.cs +++ b/v2rayN/v2rayN.WebAPI/GlobalUsings.cs @@ -3,8 +3,8 @@ global using ServiceLib.Base; global using ServiceLib.Common; global using ServiceLib.Enums; global using ServiceLib.Handler; +global using ServiceLib.Handler.Data; global using ServiceLib.Manager; -global using ServiceLib.Manager.Data; global using ServiceLib.Models.Configs; global using ServiceLib.Models.CoreConfigs; global using ServiceLib.Models.Dto; diff --git a/v2rayN/v2rayN.WebAPI/Services/RegionalPresetStager.cs b/v2rayN/v2rayN.WebAPI/Services/RegionalPresetStager.cs index 79acb967..a3f34c18 100644 --- a/v2rayN/v2rayN.WebAPI/Services/RegionalPresetStager.cs +++ b/v2rayN/v2rayN.WebAPI/Services/RegionalPresetStager.cs @@ -42,7 +42,7 @@ internal sealed class RegionalPresetStager( string.Empty, string.Empty, string.Empty, - ConfigDbManager.InitBuiltinSimpleDNS(), + ConfigDbHandler.InitBuiltinSimpleDNS(), [CreateDefaultDns(ECoreType.Xray, "V2ray"), CreateDefaultDns(ECoreType.sing_box, "sing-box")], new(null, [])); } @@ -136,7 +136,7 @@ internal sealed class RegionalPresetStager( var content = await TryDownloadAsync(url, proxy, cancellationToken); var template = content is null ? null : JsonUtils.Deserialize(content); return template is null - ? (ConfigDbManager.InitBuiltinSimpleDNS(), true) + ? (ConfigDbHandler.InitBuiltinSimpleDNS(), true) : (template, false); } diff --git a/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.Backup.cs b/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.Backup.cs index 7242a2e4..7ce76a48 100644 --- a/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.Backup.cs +++ b/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.Backup.cs @@ -36,7 +36,7 @@ public sealed partial class V2rayRuntime Config.WebDavItem.Password = input.Password; } Config.WebDavItem.DirName = input.DirName?.Trim(); - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); }); return OperationView.Ok(ApiMessageKeys.WebDavSettingsSaved); } @@ -57,7 +57,7 @@ public sealed partial class V2rayRuntime { await _mutations.RunAsync(async () => { - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); await ProfileExManager.Instance.SaveTo(); await StatisticsManager.Instance.SaveTo(); }); @@ -211,7 +211,7 @@ public sealed partial class V2rayRuntime await ProfileExManager.Instance.SaveTo(); await StatisticsManager.Instance.SaveTo(); StatisticsManager.Instance.Close(); - await _mutations.RunAsync(() => EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()), cancellationToken); + await _mutations.RunAsync(() => EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()), cancellationToken); await SQLiteHelper.Instance.DisposeDbConnectionAsync(); databaseClosed = true; diff --git a/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.CoreUpdate.cs b/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.CoreUpdate.cs index 1f4ccb3f..18b27cb2 100644 --- a/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.CoreUpdate.cs +++ b/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.CoreUpdate.cs @@ -113,7 +113,7 @@ public sealed partial class V2rayRuntime .Distinct(StringComparer.Ordinal) .ToList(); Config.CheckUpdateItem.UpdateViaProxy = input.UseProxy; - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); }); return OperationView.Ok(ApiMessageKeys.CoreUpdateSettingsSaved); diff --git a/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.Profiles.cs b/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.Profiles.cs index b598b030..bfb98048 100644 --- a/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.Profiles.cs +++ b/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.Profiles.cs @@ -39,7 +39,7 @@ public sealed partial class V2rayRuntime await _mutations.RunAsync(async () => { Config.SubIndexId = subscriptionId ?? string.Empty; - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); }); _events.Publish("profiles-changed", new { subscriptionId = Config.SubIndexId }); return OperationView.Ok(ApiMessageKeys.CommonCompleted, new { subscriptionId = Config.SubIndexId }); @@ -60,10 +60,10 @@ public sealed partial class V2rayRuntime var count = await _mutations.RunAsync(async () => { - var imported = await ConfigDbManager.AddBatchServers(Config, request.Content, groupId, request.IsSubscription); + var imported = await ConfigDbHandler.AddBatchServers(Config, request.Content, groupId, request.IsSubscription); if (imported > 0) { - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); } return imported; }); @@ -160,13 +160,13 @@ public sealed partial class V2rayRuntime try { result = await _mutations.RunAsync(() => profile.ConfigType.IsGroupType() - ? ConfigDbManager.AddServerCommon(Config, profile) + ? ConfigDbHandler.AddServerCommon(Config, profile) : profile.ConfigType switch { - EConfigType.Custom when isNew => ConfigDbManager.AddCustomServer(Config, profile, blDelete: false), - EConfigType.Outbound when isNew => ConfigDbManager.AddCustomOutboundServer(Config, profile, blDelete: false, toFile: true), - EConfigType.Custom or EConfigType.Outbound => ConfigDbManager.EditCustomServer(Config, profile), - _ => ConfigDbManager.AddServer(Config, profile), + EConfigType.Custom when isNew => ConfigDbHandler.AddCustomServer(Config, profile, blDelete: false), + EConfigType.Outbound when isNew => ConfigDbHandler.AddCustomOutboundServer(Config, profile, blDelete: false, toFile: true), + EConfigType.Custom or EConfigType.Outbound => ConfigDbHandler.EditCustomServer(Config, profile), + _ => ConfigDbHandler.AddServer(Config, profile), }); } catch (Exception exception) @@ -263,14 +263,14 @@ public sealed partial class V2rayRuntime await _mutations.RunAsync(async () => { - if (await ConfigDbManager.RemoveServers(Config, selected) != 0) + if (await ConfigDbHandler.RemoveServers(Config, selected) != 0) { throw new IOException("ServiceLib could not remove the selected profiles."); } if (removesCurrent) { - _ = await ConfigDbManager.GetDefaultServer(Config); - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + _ = await ConfigDbHandler.GetDefaultServer(Config); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); } }); @@ -297,7 +297,7 @@ public sealed partial class V2rayRuntime return OperationView.Fail("profile_not_found", ApiMessageKeys.ProfileNotFound); } - if (await _mutations.RunAsync(() => ConfigDbManager.CopyServer(Config, items)) != 0) + if (await _mutations.RunAsync(() => ConfigDbHandler.CopyServer(Config, items)) != 0) { return OperationView.Fail("profile_copy_failed", ApiMessageKeys.CommonInvalidInput); } @@ -319,7 +319,7 @@ public sealed partial class V2rayRuntime return OperationView.Fail("profile_not_found", ApiMessageKeys.ProfileNotFound); } - if (await _mutations.RunAsync(() => ConfigDbManager.MoveToGroup(Config, items, request.SubscriptionId ?? string.Empty)) != 0) + if (await _mutations.RunAsync(() => ConfigDbHandler.MoveToGroup(Config, items, request.SubscriptionId ?? string.Empty)) != 0) { return OperationView.Fail("profile_move_failed", ApiMessageKeys.CommonInvalidInput); } @@ -338,7 +338,7 @@ public sealed partial class V2rayRuntime return OperationView.Fail("profile_not_in_group", ApiMessageKeys.ProfileNotInGroup); } - var result = await _mutations.RunAsync(() => ConfigDbManager.MoveServer(Config, orderedIds, index, request.Direction, request.Position)); + var result = await _mutations.RunAsync(() => ConfigDbHandler.MoveServer(Config, orderedIds, index, request.Direction, request.Position)); _events.Publish("profiles-changed", new { subscriptionId = groupId }); return result == 0 ? OperationView.Ok(ApiMessageKeys.ProfileOrderSaved) @@ -353,7 +353,7 @@ public sealed partial class V2rayRuntime return OperationView.Fail("profile_sort_column_invalid", ApiMessageKeys.CommonInvalidInput); } - var result = await _mutations.RunAsync(() => ConfigDbManager.SortServers(Config, groupId, request.Column, request.Ascending)); + var result = await _mutations.RunAsync(() => ConfigDbHandler.SortServers(Config, groupId, request.Column, request.Ascending)); _events.Publish("profiles-changed", new { subscriptionId = groupId }); return result == 0 ? OperationView.Ok(ApiMessageKeys.ProfileOrderSaved) @@ -362,14 +362,14 @@ public sealed partial class V2rayRuntime public async Task RemoveDuplicateProfilesAsync(string? subscriptionId) { - var result = await _mutations.RunAsync(() => ConfigDbManager.DedupServerList(Config, subscriptionId ?? Config.SubIndexId ?? string.Empty)); + var result = await _mutations.RunAsync(() => ConfigDbHandler.DedupServerList(Config, subscriptionId ?? Config.SubIndexId ?? string.Empty)); _events.Publish("profiles-changed", new { subscriptionId = subscriptionId ?? Config.SubIndexId }); return OperationView.Ok(ApiMessageKeys.ProfileDeduplicated, new { removed = result.Item1 - result.Item2 }); } public async Task RemoveInvalidProfilesAsync(string? subscriptionId) { - var count = await _mutations.RunAsync(() => ConfigDbManager.RemoveInvalidServerResult(Config, subscriptionId ?? Config.SubIndexId ?? string.Empty)); + var count = await _mutations.RunAsync(() => ConfigDbHandler.RemoveInvalidServerResult(Config, subscriptionId ?? Config.SubIndexId ?? string.Empty)); _events.Publish("profiles-changed", new { subscriptionId = subscriptionId ?? Config.SubIndexId }); return count < 0 ? OperationView.Ok(ApiMessageKeys.CommonCompleted, new { removed = 0 }) @@ -389,8 +389,8 @@ public sealed partial class V2rayRuntime } var result = await _mutations.RunAsync(() => byRegion - ? ConfigDbManager.AddGroupRegionServer(Config, subscription) - : ConfigDbManager.AddGroupAllServer(Config, subscription)); + ? ConfigDbHandler.AddGroupRegionServer(Config, subscription) + : ConfigDbHandler.AddGroupAllServer(Config, subscription)); if (!result.Success) { return OperationView.Fail("profile_group_empty", ApiMessageKeys.ProfileGrouped, result.Data); diff --git a/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.Scheduling.cs b/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.Scheduling.cs index 30752765..759a53ff 100644 --- a/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.Scheduling.cs +++ b/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.Scheduling.cs @@ -61,7 +61,7 @@ public sealed partial class V2rayRuntime await using var operation = await _operations.EnterOperationAsync(token); await _mutations.RunAsync(async () => { - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); await ProfileExManager.Instance.SaveTo(); }, operation.Token); }, cancellationToken); diff --git a/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.Settings.cs b/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.Settings.cs index d7a3f214..87f3b34f 100644 --- a/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.Settings.cs +++ b/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.Settings.cs @@ -252,7 +252,7 @@ public sealed partial class V2rayRuntime } Config.RoutingBasicItem.DomainStrategy = input.DomainStrategy!; Config.RoutingBasicItem.DomainStrategy4Singbox = input.DomainStrategy4Singbox!; - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); }); } catch (Exception exception) @@ -260,7 +260,7 @@ public sealed partial class V2rayRuntime RestoreConfigValues(Config, oldConfig); try { - await _mutations.RunAsync(() => EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig())); + await _mutations.RunAsync(() => EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig())); } catch (Exception rollbackException) { @@ -314,7 +314,7 @@ public sealed partial class V2rayRuntime await _mutations.RunAsync(async () => { ApplyInboundSettings(Config.Inbound[0], input); - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); }); return await CompleteCoreAffectingChangeAsync("inbound", fingerprint != GetCoreConfigurationFingerprint(), applyContext); @@ -375,7 +375,7 @@ public sealed partial class V2rayRuntime Config.Fragment4RayItem.Lengths = fragmentLengths.ToList(); Config.Fragment4RayItem.Delays = fragmentDelays.ToList(); Config.Fragment4RayItem.MaxSplit = input.FragmentMaxSplit; - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); }); return await CompleteCoreAffectingChangeAsync("core", fingerprint != GetCoreConfigurationFingerprint(), applyContext); @@ -402,7 +402,7 @@ public sealed partial class V2rayRuntime Config.ConstItem.SrsSourceUrl = input.SrsSourceUrl; Config.ConstItem.RouteRulesTemplateSourceUrl = input.RouteRulesTemplateSourceUrl; Config.ConstItem.SubConvertUrl = input.SubConvertUrl; - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); }); if (statisticsChanged) @@ -435,7 +435,7 @@ public sealed partial class V2rayRuntime Config.SpeedTestItem.MixedConcurrencyCount = Math.Max(input.MixedConcurrencyCount, Global.SpeedTestConcurrencyCountMin); Config.SpeedTestItem.IPAPIUrl = input.IPAPIUrl; Config.SpeedTestItem.UdpTestTarget = input.UdpTestTarget; - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); }); _events.Publish("settings-changed", new { section = "speedtest", restartRequired = false }); return OperationView.Ok(ApiMessageKeys.SpeedTestSettingsSaved); @@ -467,7 +467,7 @@ public sealed partial class V2rayRuntime item.CoreType = mapping.CoreType; } } - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); }); return await CompleteCoreAffectingChangeAsync("core-types", fingerprint != GetCoreConfigurationFingerprint(), applyContext); } @@ -503,7 +503,7 @@ public sealed partial class V2rayRuntime { Config.RoutingBasicItem.DomainStrategy = input.DomainStrategy!; Config.RoutingBasicItem.DomainStrategy4Singbox = input.DomainStrategy4Singbox!; - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); }); return await CompleteCoreAffectingChangeAsync("routing", fingerprint != GetCoreConfigurationFingerprint(), applyContext); } @@ -522,7 +522,7 @@ public sealed partial class V2rayRuntime await _mutations.RunAsync(async () => { Config.SimpleDNSItem = input; - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); }); return await CompleteCoreAffectingChangeAsync("dns", fingerprint != GetCoreConfigurationFingerprint(), applyContext); } @@ -563,7 +563,7 @@ public sealed partial class V2rayRuntime || current.DomainDNSAddress != input.DomainDNSAddress || current.Remarks != (input.Remarks ?? current.Remarks); var item = ApplyDnsProfileInput(current, coreType, input); - return (Result: await ConfigDbManager.SaveDNSItems(Config, item), Changed: changed); + return (Result: await ConfigDbHandler.SaveDNSItems(Config, item), Changed: changed); }); if (result.Result == -2) { @@ -696,8 +696,8 @@ public sealed partial class V2rayRuntime item.RuleNum = parsedRules.Count; } var result = parsedRules.Count == 0 - ? await ConfigDbManager.SaveRoutingItem(Config, item) - : await ConfigDbManager.AddBatchRoutingRules(item, JsonUtils.Serialize(parsedRules, false)); + ? await ConfigDbHandler.SaveRoutingItem(Config, item) + : await ConfigDbHandler.AddBatchRoutingRules(item, JsonUtils.Serialize(parsedRules, false)); return (Result: result, Item: (RoutingItem?)item, Changed: changed); }); if (save.Result == -2) @@ -728,14 +728,14 @@ public sealed partial class V2rayRuntime { return (Removed: false, AffectsCore: false); } - await ConfigDbManager.RemoveRoutingItem(item); + await ConfigDbHandler.RemoveRoutingItem(item); if (item.IsActive) { var remaining = await ConfigDbQuery.RoutingItems() ?? []; var fallback = remaining.FirstOrDefault(); if (fallback is not null) { - if (await ConfigDbManager.SetDefaultRouting(Config, fallback) != 0) + if (await ConfigDbHandler.SetDefaultRouting(Config, fallback) != 0) { throw new IOException("ServiceLib could not select the fallback routing profile."); } @@ -743,7 +743,7 @@ public sealed partial class V2rayRuntime else { Config.RoutingBasicItem.RoutingIndexId = string.Empty; - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); } } return (Removed: true, AffectsCore: item.IsActive); @@ -772,7 +772,7 @@ public sealed partial class V2rayRuntime return (Result: -2, Changed: false); } var changed = !item.IsActive; - return (Result: changed ? await ConfigDbManager.SetDefaultRouting(Config, item) : 0, Changed: changed); + return (Result: changed ? await ConfigDbHandler.SetDefaultRouting(Config, item) : 0, Changed: changed); }); if (result.Result == -2) { @@ -823,7 +823,7 @@ public sealed partial class V2rayRuntime { return -2; } - return await ConfigDbManager.AddBatchRoutingRules(item, JsonUtils.Serialize(rules, false)); + return await ConfigDbHandler.AddBatchRoutingRules(item, JsonUtils.Serialize(rules, false)); } private async Task GetActiveRoutingSignatureAsync() @@ -930,7 +930,7 @@ public sealed partial class V2rayRuntime { return -3; } - if (await ConfigDbManager.MoveRoutingRule(rules, index, direction, position) != 0) + if (await ConfigDbHandler.MoveRoutingRule(rules, index, direction, position) != 0) { return -4; } @@ -993,7 +993,7 @@ public sealed partial class V2rayRuntime } var before = await GetActiveRoutingSignatureAsync(); - var result = await _mutations.RunAsync(() => ConfigDbManager.InitRouting(Config, true)); + var result = await _mutations.RunAsync(() => ConfigDbHandler.InitRouting(Config, true)); if (result != 0) { return OperationView.Fail("routing_import_failed", ApiMessageKeys.RoutingSaveFailed); @@ -1048,7 +1048,7 @@ public sealed partial class V2rayRuntime return -2; } var item = ApplyCoreConfigTemplateInput(current, coreType, input); - return await ConfigDbManager.SaveFullConfigTemplate(Config, item); + return await ConfigDbHandler.SaveFullConfigTemplate(Config, item); }); if (result == -2) { @@ -1160,7 +1160,7 @@ public sealed partial class V2rayRuntime await SQLiteHelper.Instance.DeleteAllAsync(); foreach (var item in stage.DnsItems) { - if (await ConfigDbManager.SaveDNSItems(Config, item) != 0) + if (await ConfigDbHandler.SaveDNSItems(Config, item) != 0) { throw new IOException($"The {item.CoreType} DNS profile could not be saved."); } @@ -1168,7 +1168,7 @@ public sealed partial class V2rayRuntime // Default routing uses embedded data only; this call performs no network I/O // because the route template source was cleared in the staged plan. - if (await ConfigDbManager.InitRouting(Config, false) != 0) + if (await ConfigDbHandler.InitRouting(Config, false) != 0) { throw new IOException("The built-in routing profiles could not be initialized."); } @@ -1177,7 +1177,7 @@ public sealed partial class V2rayRuntime { foreach (var item in stage.DnsItems) { - if (await ConfigDbManager.SaveDNSItems(Config, item) != 0) + if (await ConfigDbHandler.SaveDNSItems(Config, item) != 0) { throw new IOException($"The {item.CoreType} DNS profile could not be saved."); } @@ -1188,7 +1188,7 @@ public sealed partial class V2rayRuntime var item = await ConfigDbQuery.GetRoutingItem(itemId); if (item is not null) { - await ConfigDbManager.RemoveRoutingItem(item); + await ConfigDbHandler.RemoveRoutingItem(item); } } @@ -1207,7 +1207,7 @@ public sealed partial class V2rayRuntime foreach (var item in stage.Routing.Items) { item.Sort = ++nextSort; - if (await ConfigDbManager.AddBatchRoutingRules(item, item.RuleSet ?? "[]") != 0) + if (await ConfigDbHandler.AddBatchRoutingRules(item, item.RuleSet ?? "[]") != 0) { throw new IOException($"The routing profile '{item.Remarks}' could not be saved."); } @@ -1216,7 +1216,7 @@ public sealed partial class V2rayRuntime var defaultItem = stage.Routing.DefaultRemarks is { } remarks ? stage.Routing.Items.FirstOrDefault(item => item.Remarks == remarks) : null; - if (defaultItem is not null && await ConfigDbManager.SetDefaultRouting(Config, defaultItem) != 0) + if (defaultItem is not null && await ConfigDbHandler.SetDefaultRouting(Config, defaultItem) != 0) { throw new IOException("The first staged routing profile could not be activated."); } @@ -1226,7 +1226,7 @@ public sealed partial class V2rayRuntime { var existingDefault = currentRoutes.FirstOrDefault(item => item.Id == existingDefaultId); if (existingDefault is not null && !existingDefault.IsActive - && await ConfigDbManager.SetDefaultRouting(Config, existingDefault) != 0) + && await ConfigDbHandler.SetDefaultRouting(Config, existingDefault) != 0) { throw new IOException("The migrated default routing profile could not be activated."); } @@ -1234,7 +1234,7 @@ public sealed partial class V2rayRuntime } token.ThrowIfCancellationRequested(); - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); token.ThrowIfCancellationRequested(); }, token), () => RestoreRegionalPresetSnapshotAsync(applyContext)); @@ -1349,7 +1349,7 @@ public sealed partial class V2rayRuntime await _mutations.RunAsync(async () => { RestoreConfigValues(Config, context.OldConfig); - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); await SQLiteHelper.Instance.DeleteAllAsync(); if (context.OldRoutingItems.Length > 0 @@ -1625,7 +1625,7 @@ public sealed partial class V2rayRuntime try { RestoreConfigValues(Config, context.OldConfig); - await _mutations.RunAsync(() => EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig())); + await _mutations.RunAsync(() => EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig())); configRestored = true; await _mutations.RunAsync(async () => { diff --git a/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.cs b/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.cs index fdb45f0e..ffa6f9a3 100644 --- a/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.cs +++ b/v2rayN/v2rayN.WebAPI/Services/V2rayRuntime.cs @@ -44,7 +44,7 @@ public sealed partial class V2rayRuntime( private bool _restoring; private int _restoreAndRestartRequested; - private Config Config => ConfigTextManager.Config; + private Config Config => ConfigTextHandler.Config; private CoreRuntimeSnapshot CurrentCoreRuntime => Volatile.Read(ref _coreRuntime); public bool RestoreAndRestartRequested => Volatile.Read(ref _restoreAndRestartRequested) != 0; @@ -245,19 +245,19 @@ public sealed partial class V2rayRuntime( { Config.Inbound[0].AllowLANConn = allowProxyFromLan; } - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); }); - await ConfigDbManager.InitBuiltinDNS(Config); + await ConfigDbHandler.InitBuiltinDNS(Config); await BuiltinDnsProfileBootstrap.EnsureAsync( Config, async () => await ConfigDbQuery.DNSItems() ?? [], - ConfigDbManager.SaveDNSItems); - await ConfigDbManager.InitBuiltinFullConfigTemplate(Config); + ConfigDbHandler.SaveDNSItems); + await ConfigDbHandler.InitBuiltinFullConfigTemplate(Config); // Keep startup aligned with Desktop's StatusBarViewModel. In particular, // InitBuiltinRouting owns the RoutingIndexId -> IsActive migration and must // run even when a restored Desktop database already has routing rows. - await ConfigDbManager.InitBuiltinRouting(Config); - _ = await ConfigDbManager.GetDefaultRouting(Config); + await ConfigDbHandler.InitBuiltinRouting(Config); + _ = await ConfigDbHandler.GetDefaultRouting(Config); var restoredSubscriptions = await ConfigDbQuery.SubItems() ?? []; var normalizedSubIndexId = NormalizeSelectedSubscriptionId( Config.SubIndexId, @@ -268,8 +268,8 @@ public sealed partial class V2rayRuntime( Config.SubIndexId = normalizedSubIndexId; } var selectedProfileId = Config.IndexId; - var defaultProfile = await ConfigDbManager.GetDefaultServer(Config); - await _mutations.RunAsync(() => EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig())); + var defaultProfile = await ConfigDbHandler.GetDefaultServer(Config); + await _mutations.RunAsync(() => EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig())); await ProfileExManager.Instance.Init(); await CertPemManager.Instance.Init(Config); // The Web frontend owns its runtime and rejects generated launch contexts that enable TUN. @@ -392,7 +392,7 @@ public sealed partial class V2rayRuntime( steps.Add(new("configuration save", async deadline => { await _mutations.RunAsync( - () => EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()), + () => EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()), deadline.Token); return true; })); @@ -437,7 +437,7 @@ public sealed partial class V2rayRuntime( } var item = ToSubItem(input, null); - var result = await _mutations.RunAsync(() => ConfigDbManager.AddSubItem(Config, item)); + var result = await _mutations.RunAsync(() => ConfigDbHandler.AddSubItem(Config, item)); if (result != 0) { return new(false, "subscription_save_failed", ApiMessageKeys.SubscriptionSaveFailed, null); @@ -466,7 +466,7 @@ public sealed partial class V2rayRuntime( var item = ToSubItem(input, existing); item.Id = id; - var result = await ConfigDbManager.AddSubItem(Config, item); + var result = await ConfigDbHandler.AddSubItem(Config, item); if (result != 0) { return new SubscriptionMutationResult(false, "subscription_save_failed", ApiMessageKeys.SubscriptionSaveFailed, null); @@ -496,14 +496,14 @@ public sealed partial class V2rayRuntime( await _mutations.RunAsync(async () => { - if (await ConfigDbManager.DeleteSubItem(Config, id) != 0) + if (await ConfigDbHandler.DeleteSubItem(Config, id) != 0) { throw new IOException("ServiceLib could not delete the subscription."); } if (removesCurrentProfile) { - _ = await ConfigDbManager.GetDefaultServer(Config); - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + _ = await ConfigDbHandler.GetDefaultServer(Config); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); } }); @@ -552,7 +552,7 @@ public sealed partial class V2rayRuntime( await handler.UpdateProcess(id); operation.Token.ThrowIfCancellationRequested(); - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); await UpdateSubscriptionTimestampLockedAsync(id); }, operation.Token); _events.Publish("profiles-changed", new { subscriptionId = id }); @@ -780,7 +780,7 @@ public sealed partial class V2rayRuntime( await _mutations.RunAsync(async () => { Config.IndexId = profile.IndexId; - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); }); } @@ -789,10 +789,10 @@ public sealed partial class V2rayRuntime( private async Task GetDefaultProfileAsync() => await _mutations.RunAsync(async () => { - var selected = await ConfigDbManager.GetDefaultServer(Config); + var selected = await ConfigDbHandler.GetDefaultServer(Config); if (selected is not null) { - await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()); + await EnsureConfigSaveSucceededAsync(() => ConfigTextHandler.SaveConfig()); } return selected; }); @@ -1178,7 +1178,7 @@ public sealed partial class V2rayRuntime( if (item is not null) { item.UpdateTime = updateTime; - if (await ConfigDbManager.AddSubItem(Config, item) != 0) + if (await ConfigDbHandler.AddSubItem(Config, item) != 0) { throw new IOException("ServiceLib could not save the subscription timestamp."); } @@ -1191,7 +1191,7 @@ public sealed partial class V2rayRuntime( if (item.Enabled) { item.UpdateTime = updateTime; - if (await ConfigDbManager.AddSubItem(Config, item) != 0) + if (await ConfigDbHandler.AddSubItem(Config, item) != 0) { throw new IOException("ServiceLib could not save the subscription timestamp."); } diff --git a/v2rayN/v2rayN.WebAPI/Tests/GlobalUsings.cs b/v2rayN/v2rayN.WebAPI/Tests/GlobalUsings.cs index 1da312df..dfdc967e 100644 --- a/v2rayN/v2rayN.WebAPI/Tests/GlobalUsings.cs +++ b/v2rayN/v2rayN.WebAPI/Tests/GlobalUsings.cs @@ -1,8 +1,8 @@ global using ServiceLib; global using ServiceLib.Common; global using ServiceLib.Enums; +global using ServiceLib.Handler.Data; global using ServiceLib.Manager; -global using ServiceLib.Manager.Data; global using ServiceLib.Models.Configs; global using ServiceLib.Models.CoreConfigs; global using ServiceLib.Models.Dto; diff --git a/v2rayN/v2rayN.WebAPI/Tests/ParityValidationTests.cs b/v2rayN/v2rayN.WebAPI/Tests/ParityValidationTests.cs index 88a3a953..e70ccbf0 100644 --- a/v2rayN/v2rayN.WebAPI/Tests/ParityValidationTests.cs +++ b/v2rayN/v2rayN.WebAPI/Tests/ParityValidationTests.cs @@ -24,7 +24,7 @@ public class ParityValidationTests await code.Should().BeEqualTo("ok"); await profile.IsValid().Should().BeFalse(); - var result = await ConfigDbManager.AddShadowsocksServer(new Config(), profile, toFile: false); + var result = await ConfigDbHandler.AddShadowsocksServer(new Config(), profile, toFile: false); await result.Should().BeEqualTo(0); await profile.ConfigVersion.Should().BeEqualTo(4); @@ -41,7 +41,7 @@ public class ParityValidationTests await code.Should().BeEqualTo("ok"); await profile.IsValid().Should().BeTrue(); - var result = await ConfigDbManager.AddShadowsocksServer(new Config(), profile, toFile: false); + var result = await ConfigDbHandler.AddShadowsocksServer(new Config(), profile, toFile: false); await result.Should().BeEqualTo(0); } @@ -54,7 +54,7 @@ public class ParityValidationTests var valid = V2rayRuntime.TryValidateProfile(profile, out _, out _); await valid.Should().BeTrue(); - var result = await ConfigDbManager.AddShadowsocksServer(new Config(), profile, toFile: false); + var result = await ConfigDbHandler.AddShadowsocksServer(new Config(), profile, toFile: false); await result.Should().BeEqualTo(-1); } diff --git a/v2rayN/v2rayN.WebAPI/Tests/RegionalPresetStagingTests.cs b/v2rayN/v2rayN.WebAPI/Tests/RegionalPresetStagingTests.cs index 38be64fa..b74e0aaa 100644 --- a/v2rayN/v2rayN.WebAPI/Tests/RegionalPresetStagingTests.cs +++ b/v2rayN/v2rayN.WebAPI/Tests/RegionalPresetStagingTests.cs @@ -104,7 +104,7 @@ public class RegionalPresetStagingTests await applyCalled.Should().BeTrue(); await capturedStage.Should().NotBeNull(); await capturedStage!.DnsItems[0].NormalDNS.Should().BeEqualTo("existing-xray-data"); - await capturedStage.SimpleDnsItem.RemoteDNS.Should().BeEqualTo(ConfigDbManager.InitBuiltinSimpleDNS().RemoteDNS); + await capturedStage.SimpleDnsItem.RemoteDNS.Should().BeEqualTo(ConfigDbHandler.InitBuiltinSimpleDNS().RemoteDNS); await capturedStage.Routing.IsBuiltinFallback.Should().BeTrue(); await capturedStage.Routing.Items.Count.Should().BeEqualTo(3); await config.ConstItem.GeoSourceUrl.Should().BeEqualTo("original-geo-source"); @@ -562,7 +562,7 @@ public class RegionalPresetStagingTests var staged = await stager.StageAsync(EPresetType.Russia, CreateDnsRows(), [], null, CancellationToken.None); - var builtin = ConfigDbManager.InitBuiltinSimpleDNS(); + var builtin = ConfigDbHandler.InitBuiltinSimpleDNS(); await staged.SimpleDnsItem.RemoteDNS.Should().BeEqualTo(builtin.RemoteDNS); await staged.SimpleDnsItem.DirectDNS.Should().BeEqualTo(builtin.DirectDNS); await staged.DnsItems.All(item => item.Enabled).Should().BeTrue(); @@ -667,7 +667,7 @@ public class RegionalPresetStagingTests var staged = await stager.StageAsync(EPresetType.Russia, CreateDnsRows(), [], null, CancellationToken.None); await staged.DnsItems[0].NormalDNS.Should().BeEqualTo("existing-xray-data"); - await staged.SimpleDnsItem.RemoteDNS.Should().BeEqualTo(ConfigDbManager.InitBuiltinSimpleDNS().RemoteDNS); + await staged.SimpleDnsItem.RemoteDNS.Should().BeEqualTo(ConfigDbHandler.InitBuiltinSimpleDNS().RemoteDNS); await staged.Routing.IsBuiltinFallback.Should().BeTrue(); await staged.Routing.Items.Count.Should().BeEqualTo(3); } diff --git a/v2rayN/v2rayN.WebAPI/Tests/SniffingSettingsIntegrationTests.cs b/v2rayN/v2rayN.WebAPI/Tests/SniffingSettingsIntegrationTests.cs index 419d7cab..e99f1753 100644 --- a/v2rayN/v2rayN.WebAPI/Tests/SniffingSettingsIntegrationTests.cs +++ b/v2rayN/v2rayN.WebAPI/Tests/SniffingSettingsIntegrationTests.cs @@ -221,7 +221,7 @@ public class SniffingSettingsIntegrationTests ], GlobalHotkeys = [], CoreTypeItem = [new CoreTypeItem { ConfigType = EConfigType.VMess, CoreType = ECoreType.Xray }], - SimpleDNSItem = ConfigDbManager.InitBuiltinSimpleDNS(), + SimpleDNSItem = ConfigDbHandler.InitBuiltinSimpleDNS(), HappyEyeballs4RayItem = new HappyEyeballs4RayItem(), IndexId = string.Empty, SubIndexId = string.Empty, diff --git a/v2rayN/v2rayN/Base/WindowBase.cs b/v2rayN/v2rayN/Base/WindowBase.cs index 321f76db..5e0cb0a2 100644 --- a/v2rayN/v2rayN/Base/WindowBase.cs +++ b/v2rayN/v2rayN/Base/WindowBase.cs @@ -11,7 +11,7 @@ public class WindowBase : ReactiveWindow where TViewMode { try { - var sizeItem = ConfigTextManager.GetWindowSizeItem(GetType().Name); + var sizeItem = ConfigTextHandler.GetWindowSizeItem(GetType().Name); if (sizeItem == null) { return; @@ -32,7 +32,7 @@ public class WindowBase : ReactiveWindow where TViewMode try { - ConfigTextManager.SaveWindowSizeItem(GetType().Name, Width, Height); + ConfigTextHandler.SaveWindowSizeItem(GetType().Name, Width, Height); } catch { } } diff --git a/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs b/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs index eaf6cfe3..9313c830 100644 --- a/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs +++ b/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs @@ -10,7 +10,7 @@ public class MaterialDesignFonts { try { - var fontFamily = ConfigTextManager.Config.UiItem.CurrentFontFamily; + var fontFamily = ConfigTextHandler.Config.UiItem.CurrentFontFamily; if (fontFamily.IsNotEmpty()) { var fontPath = Utils.GetFontsPath(); diff --git a/v2rayN/v2rayN/GlobalUsings.cs b/v2rayN/v2rayN/GlobalUsings.cs index 8cfb88e4..29afbc93 100644 --- a/v2rayN/v2rayN/GlobalUsings.cs +++ b/v2rayN/v2rayN/GlobalUsings.cs @@ -27,8 +27,8 @@ global using ServiceLib.Common; global using ServiceLib.Enums; global using ServiceLib.Events; global using ServiceLib.Handler; +global using ServiceLib.Handler.Data; global using ServiceLib.Manager; -global using ServiceLib.Manager.Data; global using ServiceLib.Models.CoreConfigs; global using ServiceLib.Models.Configs; global using ServiceLib.Models.Dto; diff --git a/v2rayN/v2rayN/Manager/HotkeyManager.cs b/v2rayN/v2rayN/Manager/HotkeyManager.cs index cdbc6e72..89a91fbc 100644 --- a/v2rayN/v2rayN/Manager/HotkeyManager.cs +++ b/v2rayN/v2rayN/Manager/HotkeyManager.cs @@ -22,7 +22,7 @@ public sealed partial class HotkeyManager private void Init() { _hotkeyTriggerDic.Clear(); - foreach (var item in ConfigTextManager.Config.GlobalHotkeys) + foreach (var item in ConfigTextHandler.Config.GlobalHotkeys) { if (item.KeyCode != null && (Key)item.KeyCode != Key.None) { diff --git a/v2rayN/v2rayN/Manager/WindowsManager.cs b/v2rayN/v2rayN/Manager/WindowsManager.cs index b76d44f1..ffe90a9b 100644 --- a/v2rayN/v2rayN/Manager/WindowsManager.cs +++ b/v2rayN/v2rayN/Manager/WindowsManager.cs @@ -55,7 +55,7 @@ public sealed class WindowsManager { try { - var item = await ConfigDbManager.GetDefaultRouting(config); + var item = await ConfigDbHandler.GetDefaultRouting(config); if (item == null || item.CustomIcon.IsNullOrEmpty() || !File.Exists(item.CustomIcon)) { return null; diff --git a/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs index bf4b143a..92db2a9b 100644 --- a/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs @@ -23,7 +23,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject public ThemeSettingViewModel() { - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; RegisterSystemColorSet(_config, ModifyTheme); @@ -64,7 +64,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject { _config.UiItem.CurrentTheme = CurrentTheme; ModifyTheme(); - await ConfigTextManager.SaveConfig(); + await ConfigTextHandler.SaveConfig(); } }); @@ -83,7 +83,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject { _config.UiItem.ColorPrimaryName = SelectedSwatch?.Name; ChangePrimaryColor(SelectedSwatch.ExemplarHue.Color); - await ConfigTextManager.SaveConfig(); + await ConfigTextHandler.SaveConfig(); } }); @@ -95,7 +95,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject { _config.UiItem.CurrentFontSize = CurrentFontSize; ModifyFontSize(); - await ConfigTextManager.SaveConfig(); + await ConfigTextHandler.SaveConfig(); } }); @@ -107,7 +107,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject { _config.UiItem.CurrentLanguage = CurrentLanguage; Thread.CurrentThread.CurrentUICulture = new(CurrentLanguage); - await ConfigTextManager.SaveConfig(); + await ConfigTextHandler.SaveConfig(); NoticeManager.Instance.Enqueue(ResUI.NeedRebootTips); } }); diff --git a/v2rayN/v2rayN/Views/AddGroupServerWindow.xaml.cs b/v2rayN/v2rayN/Views/AddGroupServerWindow.xaml.cs index 8780ca3f..0f14fab7 100644 --- a/v2rayN/v2rayN/Views/AddGroupServerWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/AddGroupServerWindow.xaml.cs @@ -51,7 +51,7 @@ public partial class AddGroupServerWindow this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme); + WindowsUtils.SetDarkBorder(this, ConfigTextHandler.Config.UiItem.CurrentTheme); } private void InitializeData(ProfileItem profileItem) diff --git a/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs b/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs index fb9a76df..a3709ff1 100644 --- a/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs @@ -38,7 +38,7 @@ public partial class AddServer2Window interaction.SetOutput(fileName); }).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme); + WindowsUtils.SetDarkBorder(this, ConfigTextHandler.Config.UiItem.CurrentTheme); } private void InitializeData(ProfileItem profileItem) diff --git a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs index 1e08e990..02ebb2d4 100644 --- a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs @@ -204,7 +204,7 @@ public partial class AddServerWindow this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme); + WindowsUtils.SetDarkBorder(this, ConfigTextHandler.Config.UiItem.CurrentTheme); } private void InitializeData(ProfileItem profileItem) diff --git a/v2rayN/v2rayN/Views/ClashConnectionsView.xaml.cs b/v2rayN/v2rayN/Views/ClashConnectionsView.xaml.cs index b2e06853..41f8c8bb 100644 --- a/v2rayN/v2rayN/Views/ClashConnectionsView.xaml.cs +++ b/v2rayN/v2rayN/Views/ClashConnectionsView.xaml.cs @@ -14,7 +14,7 @@ public partial class ClashConnectionsView public ClashConnectionsView() { InitializeComponent(); - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click; diff --git a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs index 70074959..52e79907 100644 --- a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs @@ -8,7 +8,7 @@ public partial class DNSSettingWindow { InitializeComponent(); - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; cmbDirectDNSStrategy.ItemsSource = Global.DomainStrategy; cmbRemoteDNSStrategy.ItemsSource = Global.DomainStrategy; @@ -72,7 +72,7 @@ public partial class DNSSettingWindow this.OneWayBind(ViewModel, vm => vm.IsSimpleDNSEnabled, v => v.gridBasicDNSSettings.IsEnabled).DisposeWith(disposables); this.OneWayBind(ViewModel, vm => vm.IsSimpleDNSEnabled, v => v.gridAdvancedDNSSettings.IsEnabled).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme); + WindowsUtils.SetDarkBorder(this, ConfigTextHandler.Config.UiItem.CurrentTheme); } private void linkDnsObjectDoc_Click(object sender, RoutedEventArgs e) diff --git a/v2rayN/v2rayN/Views/FullConfigTemplateWindow.xaml.cs b/v2rayN/v2rayN/Views/FullConfigTemplateWindow.xaml.cs index 14001c11..01205456 100644 --- a/v2rayN/v2rayN/Views/FullConfigTemplateWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/FullConfigTemplateWindow.xaml.cs @@ -8,7 +8,7 @@ public partial class FullConfigTemplateWindow { InitializeComponent(); - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; this.WhenActivated(disposables => { @@ -25,7 +25,7 @@ public partial class FullConfigTemplateWindow this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme); + WindowsUtils.SetDarkBorder(this, ConfigTextHandler.Config.UiItem.CurrentTheme); } private void linkFullConfigTemplateDoc_Click(object sender, RoutedEventArgs e) diff --git a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs index f2612b70..c2229449 100644 --- a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs @@ -21,7 +21,7 @@ public partial class GlobalHotkeySettingWindow this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); BindingData(); }); - WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme); + WindowsUtils.SetDarkBorder(this, ConfigTextHandler.Config.UiItem.CurrentTheme); Init(); } diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml.cs b/v2rayN/v2rayN/Views/MainWindow.xaml.cs index 72f318c8..88a89c51 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/MainWindow.xaml.cs @@ -17,7 +17,7 @@ public partial class MainWindow { InitializeComponent(); - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; ThreadPool.RegisterWaitForSingleObject(App.ProgramStarted, OnProgramStarted, null, -1, false); App.Current.SessionEnding += Current_SessionEnding; @@ -345,15 +345,15 @@ public partial class MainWindow private void StorageUI() { - ConfigTextManager.SaveWindowSizeItem(GetType().Name, Width, Height); + ConfigTextHandler.SaveWindowSizeItem(GetType().Name, Width, Height); if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Horizontal) { - ConfigTextManager.SaveMainGirdHeight(gridMain.ColumnDefinitions[0].ActualWidth, gridMain.ColumnDefinitions[2].ActualWidth); + ConfigTextHandler.SaveMainGirdHeight(gridMain.ColumnDefinitions[0].ActualWidth, gridMain.ColumnDefinitions[2].ActualWidth); } else if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Vertical) { - ConfigTextManager.SaveMainGirdHeight(gridMain1.RowDefinitions[0].ActualHeight, gridMain1.RowDefinitions[2].ActualHeight); + ConfigTextHandler.SaveMainGirdHeight(gridMain1.RowDefinitions[0].ActualHeight, gridMain1.RowDefinitions[2].ActualHeight); } } diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs index c68bb5ff..b05f6f4f 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs @@ -10,7 +10,7 @@ public partial class OptionSettingWindow { InitializeComponent(); - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; clbdestOverride.SelectionChanged += ClbdestOverride_SelectionChanged; btnBrowseCustomSystemProxyPacPath.Click += BtnBrowseCustomSystemProxyPacPath_Click; @@ -149,7 +149,7 @@ public partial class OptionSettingWindow this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme); + WindowsUtils.SetDarkBorder(this, ConfigTextHandler.Config.UiItem.CurrentTheme); } private async Task InitSettingFont() diff --git a/v2rayN/v2rayN/Views/ProfilesSelectWindow.xaml.cs b/v2rayN/v2rayN/Views/ProfilesSelectWindow.xaml.cs index 488a7d18..ec3336bf 100644 --- a/v2rayN/v2rayN/Views/ProfilesSelectWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/ProfilesSelectWindow.xaml.cs @@ -39,7 +39,7 @@ public partial class ProfilesSelectWindow }).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme); + WindowsUtils.SetDarkBorder(this, ConfigTextHandler.Config.UiItem.CurrentTheme); } private void AllowMultiSelect(bool allow) diff --git a/v2rayN/v2rayN/Views/ProfilesView.xaml.cs b/v2rayN/v2rayN/Views/ProfilesView.xaml.cs index 29ac7851..944d1966 100644 --- a/v2rayN/v2rayN/Views/ProfilesView.xaml.cs +++ b/v2rayN/v2rayN/Views/ProfilesView.xaml.cs @@ -17,7 +17,7 @@ public partial class ProfilesView InitializeComponent(); lstGroup.MaxHeight = Math.Floor(SystemParameters.WorkArea.Height * 0.20 / 40) * 40; - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click; txtServerFilter.PreviewKeyDown += TxtServerFilter_PreviewKeyDown; diff --git a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs index 4974b16b..35fb8f7f 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs @@ -37,7 +37,7 @@ public partial class RoutingRuleDetailsWindow this.BindCommand(ViewModel, vm => vm.SelectProfileCmd, v => v.btnSelectProfile).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme); + WindowsUtils.SetDarkBorder(this, ConfigTextHandler.Config.UiItem.CurrentTheme); } private void InitializeData(RulesItem rulesItem) diff --git a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs index 4fceeda8..87a9515e 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs @@ -76,7 +76,7 @@ public partial class RoutingRuleSettingWindow interaction.SetOutput(fileName); }).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme); + WindowsUtils.SetDarkBorder(this, ConfigTextHandler.Config.UiItem.CurrentTheme); } private void Window_Loaded(object sender, RoutedEventArgs e) diff --git a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs index ddbfbe77..1db3a3f1 100644 --- a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs @@ -37,7 +37,7 @@ public partial class RoutingSettingWindow interaction.SetOutput(result); }).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme); + WindowsUtils.SetDarkBorder(this, ConfigTextHandler.Config.UiItem.CurrentTheme); } private void RoutingSettingWindow_Closing(object? sender, System.ComponentModel.CancelEventArgs e) diff --git a/v2rayN/v2rayN/Views/StatusBarView.xaml.cs b/v2rayN/v2rayN/Views/StatusBarView.xaml.cs index a6bfea89..d3612ea8 100644 --- a/v2rayN/v2rayN/Views/StatusBarView.xaml.cs +++ b/v2rayN/v2rayN/Views/StatusBarView.xaml.cs @@ -9,7 +9,7 @@ public partial class StatusBarView public StatusBarView() { InitializeComponent(); - _config = ConfigTextManager.Config; + _config = ConfigTextHandler.Config; menuExit.Click += menuExit_Click; txtRunningServerDisplay.PreviewMouseDown += txtRunningInfoDisplay_MouseDoubleClick; diff --git a/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs b/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs index a58cba62..86b2cb8a 100644 --- a/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs @@ -35,7 +35,7 @@ public partial class SubEditWindow this.BindCommand(ViewModel, vm => vm.SelectNextProfileCmd, v => v.btnSelectNextProfile).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme); + WindowsUtils.SetDarkBorder(this, ConfigTextHandler.Config.UiItem.CurrentTheme); } private void Window_Loaded(object sender, RoutedEventArgs e) diff --git a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs index a79de157..7082f6b8 100644 --- a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs @@ -47,7 +47,7 @@ public partial class SubSettingWindow interaction.SetOutput(RxVoid.Default); }).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme); + WindowsUtils.SetDarkBorder(this, ConfigTextHandler.Config.UiItem.CurrentTheme); } private async Task ShareSub(string url)