diff --git a/v2rayN/ServiceLib/Common/DownloaderHelper.cs b/v2rayN/ServiceLib/Common/DownloaderHelper.cs index 986912d7..fe468566 100644 --- a/v2rayN/ServiceLib/Common/DownloaderHelper.cs +++ b/v2rayN/ServiceLib/Common/DownloaderHelper.cs @@ -36,7 +36,7 @@ namespace ServiceLib.Common } }; - using var downloader = new DownloadService(downloadOpt); + using var downloader = new Downloader.DownloadService(downloadOpt); downloader.DownloadFileCompleted += (sender, value) => { if (value.Error != null) @@ -76,7 +76,7 @@ namespace ServiceLib.Common int totalSecond = 0; var hasValue = false; double maxSpeed = 0; - using var downloader = new DownloadService(downloadOpt); + using var downloader = new Downloader.DownloadService(downloadOpt); //downloader.DownloadStarted += (sender, value) => //{ // if (progress != null) @@ -145,7 +145,7 @@ namespace ServiceLib.Common var progressPercentage = 0; var hasValue = false; - using var downloader = new DownloadService(downloadOpt); + using var downloader = new Downloader.DownloadService(downloadOpt); downloader.DownloadStarted += (sender, value) => { progress?.Report(0); diff --git a/v2rayN/ServiceLib/GlobalUsings.cs b/v2rayN/ServiceLib/GlobalUsings.cs index 834ccd5c..23d2a064 100644 --- a/v2rayN/ServiceLib/GlobalUsings.cs +++ b/v2rayN/ServiceLib/GlobalUsings.cs @@ -2,8 +2,9 @@ global using ServiceLib.Common; global using ServiceLib.Enums; global using ServiceLib.Handler; -global using ServiceLib.Handler.CoreConfig; global using ServiceLib.Handler.Fmt; -global using ServiceLib.Handler.Statistics; +global using ServiceLib.Services; +global using ServiceLib.Services.Statistics; +global using ServiceLib.Services.CoreConfig; global using ServiceLib.Models; global using ServiceLib.Resx; \ No newline at end of file diff --git a/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigHandler.cs b/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs similarity index 87% rename from v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigHandler.cs rename to v2rayN/ServiceLib/Handler/CoreConfigHandler.cs index ab42da0b..c560a0c8 100644 --- a/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs @@ -1,4 +1,6 @@ -namespace ServiceLib.Handler.CoreConfig +using ServiceLib.Services.CoreConfig; + +namespace ServiceLib.Handler { /// /// Core configuration file processing class @@ -20,14 +22,14 @@ msg = ResUI.InitialConfiguration; if (node.configType == EConfigType.Custom) { - if (node.coreType is ECoreType.mihomo) + if (node.coreType is ECoreType.mihomo) { - var configGenClash = new CoreConfigClash(config); + var configGenClash = new CoreConfigClashService(config); return configGenClash.GenerateClientCustomConfig(node, fileName, out msg); } if (node.coreType is ECoreType.sing_box) { - var configGenSingbox = new CoreConfigSingbox(config); + var configGenSingbox = new CoreConfigSingboxService(config); return configGenSingbox.GenerateClientCustomConfig(node, fileName, out msg); } else @@ -37,7 +39,7 @@ } else if (AppHandler.Instance.GetCoreType(node, node.configType) == ECoreType.sing_box) { - var configGenSingbox = new CoreConfigSingbox(config); + var configGenSingbox = new CoreConfigSingboxService(config); if (configGenSingbox.GenerateClientConfigContent(node, out SingboxConfig? singboxConfig, out msg) != 0) { return -1; @@ -53,7 +55,7 @@ } else { - var coreConfigV2ray = new CoreConfigV2ray(config); + var coreConfigV2ray = new CoreConfigV2rayService(config); if (coreConfigV2ray.GenerateClientConfigContent(node, out V2rayConfig? v2rayConfig, out msg) != 0) { return -1; @@ -128,7 +130,7 @@ { if (coreType == ECoreType.sing_box) { - if (new CoreConfigSingbox(config).GenerateClientSpeedtestConfig(selecteds, out SingboxConfig? singboxConfig, out msg) != 0) + if (new CoreConfigSingboxService(config).GenerateClientSpeedtestConfig(selecteds, out SingboxConfig? singboxConfig, out msg) != 0) { return -1; } @@ -136,7 +138,7 @@ } else { - if (new CoreConfigV2ray(config).GenerateClientSpeedtestConfig(selecteds, out V2rayConfig? v2rayConfig, out msg) != 0) + if (new CoreConfigV2rayService(config).GenerateClientSpeedtestConfig(selecteds, out V2rayConfig? v2rayConfig, out msg) != 0) { return -1; } @@ -150,7 +152,7 @@ msg = ResUI.CheckServerSettings; if (coreType == ECoreType.sing_box) { - if (new CoreConfigSingbox(config).GenerateClientMultipleLoadConfig(selecteds, out SingboxConfig? singboxConfig, out msg) != 0) + if (new CoreConfigSingboxService(config).GenerateClientMultipleLoadConfig(selecteds, out SingboxConfig? singboxConfig, out msg) != 0) { return -1; } @@ -158,7 +160,7 @@ } else if (coreType == ECoreType.Xray) { - if (new CoreConfigV2ray(config).GenerateClientMultipleLoadConfig(selecteds, out V2rayConfig? v2rayConfig, out msg) != 0) + if (new CoreConfigV2rayService(config).GenerateClientMultipleLoadConfig(selecteds, out V2rayConfig? v2rayConfig, out msg) != 0) { return -1; } diff --git a/v2rayN/ServiceLib/Handler/Statistics/StatisticsHandler.cs b/v2rayN/ServiceLib/Handler/StatisticsHandler.cs similarity index 91% rename from v2rayN/ServiceLib/Handler/Statistics/StatisticsHandler.cs rename to v2rayN/ServiceLib/Handler/StatisticsHandler.cs index 6ca0d4f3..475e5b3d 100644 --- a/v2rayN/ServiceLib/Handler/Statistics/StatisticsHandler.cs +++ b/v2rayN/ServiceLib/Handler/StatisticsHandler.cs @@ -1,4 +1,6 @@ -namespace ServiceLib.Handler.Statistics +using ServiceLib.Services.Statistics; + +namespace ServiceLib.Handler { public class StatisticsHandler { @@ -9,8 +11,8 @@ private ServerStatItem? _serverStatItem; private List _lstServerStat; private Action _updateFunc; - private StatisticsV2ray? _statisticsV2Ray; - private StatisticsSingbox? _statisticsSingbox; + private StatisticsV2rayService? _statisticsV2Ray; + private StatisticsSingboxService? _statisticsSingbox; public List ServerStat => _lstServerStat; @@ -25,8 +27,8 @@ InitData(); - _statisticsV2Ray = new StatisticsV2ray(config, UpdateServerStat); - _statisticsSingbox = new StatisticsSingbox(config, UpdateServerStat); + _statisticsV2Ray = new StatisticsV2rayService(config, UpdateServerStat); + _statisticsSingbox = new StatisticsSingboxService(config, UpdateServerStat); } public void Close() diff --git a/v2rayN/ServiceLib/Handler/TaskHandler.cs b/v2rayN/ServiceLib/Handler/TaskHandler.cs index 61cddeff..abcf2cac 100644 --- a/v2rayN/ServiceLib/Handler/TaskHandler.cs +++ b/v2rayN/ServiceLib/Handler/TaskHandler.cs @@ -1,4 +1,6 @@ -namespace ServiceLib.Handler +using ServiceLib.Services; + +namespace ServiceLib.Handler { public class TaskHandler { @@ -20,7 +22,7 @@ await Task.Delay(60000); Logging.SaveLog("UpdateTaskRunSubscription"); - var updateHandle = new UpdateHandler(); + var updateHandle = new UpdateService(); while (true) { var updateTime = ((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds(); @@ -53,7 +55,7 @@ //await Task.Delay(1000 * 120); Logging.SaveLog("UpdateTaskRunGeo"); - var updateHandle = new UpdateHandler(); + var updateHandle = new UpdateService(); while (true) { await Task.Delay(1000 * 3600); diff --git a/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigClash.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigClashService.cs similarity index 98% rename from v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigClash.cs rename to v2rayN/ServiceLib/Services/CoreConfig/CoreConfigClashService.cs index b81ad37b..36a97529 100644 --- a/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigClash.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigClashService.cs @@ -1,13 +1,13 @@ -namespace ServiceLib.Handler.CoreConfig +namespace ServiceLib.Services.CoreConfig { /// /// Core configuration file processing class /// - public class CoreConfigClash + public class CoreConfigClashService { private Config _config; - public CoreConfigClash(Config config) + public CoreConfigClashService(Config config) { _config = config; } diff --git a/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigSingbox.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs similarity index 99% rename from v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigSingbox.cs rename to v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs index 712a0a57..f1ec7169 100644 --- a/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigSingbox.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs @@ -2,13 +2,13 @@ using System.Net; using System.Net.NetworkInformation; -namespace ServiceLib.Handler.CoreConfig +namespace ServiceLib.Services.CoreConfig { - public class CoreConfigSingbox + public class CoreConfigSingboxService { private Config _config; - public CoreConfigSingbox(Config config) + public CoreConfigSingboxService(Config config) { _config = config; } @@ -192,7 +192,7 @@ namespace ServiceLib.Handler.CoreConfig { continue; } - if ((it.configType is EConfigType.VLESS or EConfigType.Trojan) + if (it.configType is EConfigType.VLESS or EConfigType.Trojan && item.streamSecurity == Global.StreamSecurityReality && item.publicKey.IsNullOrEmpty()) { @@ -476,7 +476,7 @@ namespace ServiceLib.Handler.CoreConfig singboxConfig.inbounds = []; if (!_config.tunModeItem.enableTun - || (_config.tunModeItem.enableTun && _config.tunModeItem.enableExInbound && _config.runningCoreType == ECoreType.sing_box)) + || _config.tunModeItem.enableTun && _config.tunModeItem.enableExInbound && _config.runningCoreType == ECoreType.sing_box) { var inbound = new Inbound4Sbox() { diff --git a/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigV2ray.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs similarity index 99% rename from v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigV2ray.cs rename to v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs index 14f4df67..16cbf5fd 100644 --- a/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigV2ray.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs @@ -2,13 +2,13 @@ using System.Net.NetworkInformation; using System.Text.Json.Nodes; -namespace ServiceLib.Handler.CoreConfig +namespace ServiceLib.Services.CoreConfig { - public class CoreConfigV2ray + public class CoreConfigV2rayService { private Config _config; - public CoreConfigV2ray(Config config) + public CoreConfigV2rayService(Config config) { _config = config; } @@ -308,7 +308,7 @@ namespace ServiceLib.Handler.CoreConfig { continue; } - if ((it.configType is EConfigType.VLESS or EConfigType.Trojan) + if (it.configType is EConfigType.VLESS or EConfigType.Trojan && item.streamSecurity == Global.StreamSecurityReality && item.publicKey.IsNullOrEmpty()) { diff --git a/v2rayN/ServiceLib/Handler/DownloadHandler.cs b/v2rayN/ServiceLib/Services/DownloadService.cs similarity index 99% rename from v2rayN/ServiceLib/Handler/DownloadHandler.cs rename to v2rayN/ServiceLib/Services/DownloadService.cs index 8b7832d5..bd6dc362 100644 --- a/v2rayN/ServiceLib/Handler/DownloadHandler.cs +++ b/v2rayN/ServiceLib/Services/DownloadService.cs @@ -3,12 +3,12 @@ using System.Net; using System.Net.Http.Headers; using System.Net.Sockets; -namespace ServiceLib.Handler +namespace ServiceLib.Services { /// ///Download /// - public class DownloadHandler + public class DownloadService { public event EventHandler? UpdateCompleted; diff --git a/v2rayN/ServiceLib/Handler/SpeedtestHandler.cs b/v2rayN/ServiceLib/Services/SpeedtestService.cs similarity index 95% rename from v2rayN/ServiceLib/Handler/SpeedtestHandler.cs rename to v2rayN/ServiceLib/Services/SpeedtestService.cs index b7d124b1..76aa57d4 100644 --- a/v2rayN/ServiceLib/Handler/SpeedtestHandler.cs +++ b/v2rayN/ServiceLib/Services/SpeedtestService.cs @@ -2,9 +2,9 @@ using System.Net; using System.Net.Sockets; -namespace ServiceLib.Handler +namespace ServiceLib.Services { - public class SpeedtestHandler + public class SpeedtestService { private Config? _config; private CoreHandler _coreHandler; @@ -13,7 +13,7 @@ namespace ServiceLib.Handler private Action _updateFunc; private bool _exitLoop = false; - public SpeedtestHandler(Config config, CoreHandler coreHandler, List selecteds, ESpeedActionType actionType, Action update) + public SpeedtestService(Config config, CoreHandler coreHandler, List selecteds, ESpeedActionType actionType, Action update) { _config = config; _coreHandler = coreHandler; @@ -144,7 +144,7 @@ namespace ServiceLib.Handler return Task.CompletedTask; } - DownloadHandler downloadHandle = new DownloadHandler(); + DownloadService downloadHandle = new DownloadService(); List tasks = new(); foreach (var it in _selecteds) @@ -211,7 +211,7 @@ namespace ServiceLib.Handler string url = _config.speedTestItem.speedTestUrl; var timeout = _config.speedTestItem.speedTestTimeout; - DownloadHandler downloadHandle = new(); + DownloadService downloadHandle = new(); foreach (var it in _selecteds) { @@ -241,7 +241,7 @@ namespace ServiceLib.Handler WebProxy webProxy = new(Global.Loopback, it.port); - await downloadHandle.DownloadDataAsync(url, webProxy, timeout, (bool success, string msg) => + await downloadHandle.DownloadDataAsync(url, webProxy, timeout, (success, msg) => { decimal.TryParse(msg, out decimal dec); if (dec > 0) @@ -273,7 +273,7 @@ namespace ServiceLib.Handler string url = _config.speedTestItem.speedTestUrl; var timeout = _config.speedTestItem.speedTestTimeout; - DownloadHandler downloadHandle = new(); + DownloadService downloadHandle = new(); foreach (var it in _selecteds) { @@ -303,7 +303,7 @@ namespace ServiceLib.Handler if (item is null) continue; WebProxy webProxy = new(Global.Loopback, it.port); - _ = downloadHandle.DownloadDataAsync(url, webProxy, timeout, (bool success, string msg) => + _ = downloadHandle.DownloadDataAsync(url, webProxy, timeout, (success, msg) => { decimal.TryParse(msg, out decimal dec); if (dec > 0) @@ -334,7 +334,7 @@ namespace ServiceLib.Handler await RunSpeedTestMulti(); } - private async Task GetRealPingTime(DownloadHandler downloadHandle, IWebProxy webProxy) + private async Task GetRealPingTime(DownloadService downloadHandle, IWebProxy webProxy) { int responseTime = await downloadHandle.GetRealPingTime(_config.speedTestItem.speedPingTestUrl, webProxy, 10); //string output = Utile.IsNullOrEmpty(status) ? FormatOut(responseTime, "ms") : status; @@ -349,7 +349,7 @@ namespace ServiceLib.Handler { if (!IPAddress.TryParse(url, out IPAddress? ipAddress)) { - IPHostEntry ipHostInfo = System.Net.Dns.GetHostEntry(url); + IPHostEntry ipHostInfo = Dns.GetHostEntry(url); ipAddress = ipHostInfo.AddressList[0]; } diff --git a/v2rayN/ServiceLib/Handler/Statistics/StatisticsSingbox.cs b/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs similarity index 93% rename from v2rayN/ServiceLib/Handler/Statistics/StatisticsSingbox.cs rename to v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs index 60aca157..fac3d1b7 100644 --- a/v2rayN/ServiceLib/Handler/Statistics/StatisticsSingbox.cs +++ b/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs @@ -1,9 +1,9 @@ using System.Net.WebSockets; using System.Text; -namespace ServiceLib.Handler.Statistics +namespace ServiceLib.Services.Statistics { - public class StatisticsSingbox + public class StatisticsSingboxService { private Config _config; private bool _exitFlag; @@ -11,7 +11,7 @@ namespace ServiceLib.Handler.Statistics private string url = string.Empty; private Action _updateFunc; - public StatisticsSingbox(Config config, Action update) + public StatisticsSingboxService(Config config, Action update) { _config = config; _updateFunc = update; @@ -63,7 +63,7 @@ namespace ServiceLib.Handler.Statistics await Task.Delay(1000); try { - if (!(_config.IsRunningCore(ECoreType.sing_box))) + if (!_config.IsRunningCore(ECoreType.sing_box)) { continue; } diff --git a/v2rayN/ServiceLib/Handler/Statistics/StatisticsV2ray.cs b/v2rayN/ServiceLib/Services/Statistics/StatisticsV2rayService.cs similarity index 94% rename from v2rayN/ServiceLib/Handler/Statistics/StatisticsV2ray.cs rename to v2rayN/ServiceLib/Services/Statistics/StatisticsV2rayService.cs index 32399f4e..a35266ef 100644 --- a/v2rayN/ServiceLib/Handler/Statistics/StatisticsV2ray.cs +++ b/v2rayN/ServiceLib/Services/Statistics/StatisticsV2rayService.cs @@ -2,9 +2,9 @@ using Grpc.Net.Client; using ProtosLib.Statistics; -namespace ServiceLib.Handler.Statistics +namespace ServiceLib.Services.Statistics { - public class StatisticsV2ray + public class StatisticsV2rayService { private Models.Config _config; private GrpcChannel? _channel; @@ -12,7 +12,7 @@ namespace ServiceLib.Handler.Statistics private bool _exitFlag; private Action _updateFunc; - public StatisticsV2ray(Models.Config config, Action update) + public StatisticsV2rayService(Models.Config config, Action update) { _config = config; _updateFunc = update; @@ -51,7 +51,7 @@ namespace ServiceLib.Handler.Statistics await Task.Delay(1000); try { - if (!(_config.IsRunningCore(ECoreType.Xray))) + if (!_config.IsRunningCore(ECoreType.Xray)) { continue; } diff --git a/v2rayN/ServiceLib/Handler/UpdateHandler.cs b/v2rayN/ServiceLib/Services/UpdateService.cs similarity index 97% rename from v2rayN/ServiceLib/Handler/UpdateHandler.cs rename to v2rayN/ServiceLib/Services/UpdateService.cs index 35db828e..20ddf97c 100644 --- a/v2rayN/ServiceLib/Handler/UpdateHandler.cs +++ b/v2rayN/ServiceLib/Services/UpdateService.cs @@ -3,9 +3,9 @@ using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; -namespace ServiceLib.Handler +namespace ServiceLib.Services { - public class UpdateHandler + public class UpdateService { private Action _updateFunc; private Config _config; @@ -32,7 +32,7 @@ namespace ServiceLib.Handler var url = string.Empty; var fileName = string.Empty; - DownloadHandler downloadHandle = new(); + DownloadService downloadHandle = new(); downloadHandle.UpdateCompleted += (sender2, args) => { if (args.Success) @@ -74,7 +74,7 @@ namespace ServiceLib.Handler var url = string.Empty; var fileName = string.Empty; - DownloadHandler downloadHandle = new(); + DownloadService downloadHandle = new(); downloadHandle.UpdateCompleted += (sender2, args) => { if (args.Success) @@ -110,7 +110,7 @@ namespace ServiceLib.Handler url = args.Url; var ext = Path.GetExtension(url); - fileName = Utils.GetTempPath(Utils.GetGUID()+ ext); + fileName = Utils.GetTempPath(Utils.GetGUID() + ext); await downloadHandle.DownloadFileAsync(url, fileName, true, _timeout); } else @@ -144,7 +144,7 @@ namespace ServiceLib.Handler string url = item.url.TrimEx(); string userAgent = item.userAgent.TrimEx(); string hashCode = $"{item.remarks}->"; - if (Utils.IsNullOrEmpty(id) || Utils.IsNullOrEmpty(url) || (Utils.IsNotEmpty(subId) && item.id != subId)) + if (Utils.IsNullOrEmpty(id) || Utils.IsNullOrEmpty(url) || Utils.IsNotEmpty(subId) && item.id != subId) { //_updateFunc(false, $"{hashCode}{ResUI.MsgNoValidSubscription}"); continue; @@ -159,7 +159,7 @@ namespace ServiceLib.Handler continue; } - var downloadHandle = new DownloadHandler(); + var downloadHandle = new DownloadService(); downloadHandle.Error += (sender2, args) => { _updateFunc(false, $"{hashCode}{args.GetException().Message}"); @@ -264,13 +264,13 @@ namespace ServiceLib.Handler public async Task RunAvailabilityCheck(Action update) { - var time = await (new DownloadHandler()).RunAvailabilityCheck(null); + var time = await new DownloadService().RunAvailabilityCheck(null); update(false, string.Format(ResUI.TestMeOutput, time)); } #region private - private async Task CheckUpdateAsync(DownloadHandler downloadHandle, ECoreType type, bool preRelease) + private async Task CheckUpdateAsync(DownloadService downloadHandle, ECoreType type, bool preRelease) { try { @@ -465,7 +465,7 @@ namespace ServiceLib.Handler var url = string.Format(Global.GeoUrl, geoName); var fileName = Utils.GetTempPath(Utils.GetGUID()); - DownloadHandler downloadHandle = new(); + DownloadService downloadHandle = new(); downloadHandle.UpdateCompleted += (sender2, args) => { if (args.Success) diff --git a/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs b/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs index 26d4720b..7ed31f49 100644 --- a/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs @@ -141,7 +141,7 @@ namespace ServiceLib.ViewModels UpdatedPlusPlus(_geo, ""); } } - await (new UpdateHandler()).UpdateGeoFileAll(_config, _updateUI) + await (new UpdateService()).UpdateGeoFileAll(_config, _updateUI) .ContinueWith(t => { UpdatedPlusPlus(_geo, ""); @@ -169,7 +169,7 @@ namespace ServiceLib.ViewModels UpdatedPlusPlus(_v2rayN, msg); } } - await (new UpdateHandler()).CheckUpdateGuiN(_config, _updateUI, preRelease) + await (new UpdateService()).CheckUpdateGuiN(_config, _updateUI, preRelease) .ContinueWith(t => { UpdatedPlusPlus(_v2rayN, ""); @@ -189,7 +189,7 @@ namespace ServiceLib.ViewModels } } var type = (ECoreType)Enum.Parse(typeof(ECoreType), item.coreType); - await (new UpdateHandler()).CheckUpdateCore(type, _config, _updateUI, preRelease) + await (new UpdateService()).CheckUpdateCore(type, _config, _updateUI, preRelease) .ContinueWith(t => { UpdatedPlusPlus(item.coreType, ""); diff --git a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs index b6e6ac7b..9c4cbd0c 100644 --- a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs @@ -629,7 +629,7 @@ namespace ServiceLib.ViewModels { return; } - await (new UpdateHandler()).RunAvailabilityCheck(async (bool success, string msg) => + await (new UpdateService()).RunAvailabilityCheck(async (bool success, string msg) => { _noticeHandler?.SendMessageEx(msg); await _updateView?.Invoke(EViewAction.DispatcherServerAvailability, msg); @@ -655,7 +655,7 @@ namespace ServiceLib.ViewModels public void UpdateSubscriptionProcess(string subId, bool blProxy) { - (new UpdateHandler()).UpdateSubscriptionProcess(_config, subId, blProxy, UpdateTaskHandler); + (new UpdateService()).UpdateSubscriptionProcess(_config, subId, blProxy, UpdateTaskHandler); } #endregion Subscription diff --git a/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs b/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs index 59085a2e..722897d7 100644 --- a/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs @@ -2,6 +2,7 @@ using DynamicData; using DynamicData.Binding; using ReactiveUI; using ReactiveUI.Fody.Helpers; +using ServiceLib.Services; using Splat; using System.Reactive; using System.Reactive.Linq; @@ -17,7 +18,7 @@ namespace ServiceLib.ViewModels private string _serverFilter = string.Empty; private Dictionary _dicHeaderSort = new(); - private SpeedtestHandler? _speedtestHandler; + private SpeedtestService? _speedtestHandler; #endregion private prop @@ -670,7 +671,7 @@ namespace ServiceLib.ViewModels var coreHandler = Locator.Current.GetService(); if (coreHandler != null) { - _speedtestHandler = new SpeedtestHandler(_config, coreHandler, lstSelecteds, actionType, UpdateSpeedtestHandler); + _speedtestHandler = new SpeedtestService(_config, coreHandler, lstSelecteds, actionType, UpdateSpeedtestHandler); } } diff --git a/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs index ef988c74..bb5c8752 100644 --- a/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs @@ -1,6 +1,7 @@ using DynamicData.Binding; using ReactiveUI; using ReactiveUI.Fody.Helpers; +using ServiceLib.Services; using Splat; using System.Reactive; @@ -295,7 +296,7 @@ namespace ServiceLib.ViewModels return; } - DownloadHandler downloadHandle = new DownloadHandler(); + DownloadService downloadHandle = new DownloadService(); var result = await downloadHandle.TryDownloadString(url, true, ""); var ret = await AddBatchRoutingRulesAsync(SelectedRouting, result); if (ret == 0)