mirror of https://github.com/2dust/v2rayN
Refactor some service
parent
3bdef4d6d8
commit
d5c6a42a9a
|
@ -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);
|
||||
|
|
|
@ -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;
|
|
@ -1,4 +1,6 @@
|
|||
namespace ServiceLib.Handler.CoreConfig
|
||||
using ServiceLib.Services.CoreConfig;
|
||||
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
/// <summary>
|
||||
/// 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;
|
||||
}
|
|
@ -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<ServerStatItem> _lstServerStat;
|
||||
private Action<ServerSpeedItem> _updateFunc;
|
||||
private StatisticsV2ray? _statisticsV2Ray;
|
||||
private StatisticsSingbox? _statisticsSingbox;
|
||||
private StatisticsV2rayService? _statisticsV2Ray;
|
||||
private StatisticsSingboxService? _statisticsSingbox;
|
||||
|
||||
public List<ServerStatItem> 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()
|
|
@ -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);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
namespace ServiceLib.Handler.CoreConfig
|
||||
namespace ServiceLib.Services.CoreConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Core configuration file processing class
|
||||
/// </summary>
|
||||
public class CoreConfigClash
|
||||
public class CoreConfigClashService
|
||||
{
|
||||
private Config _config;
|
||||
|
||||
public CoreConfigClash(Config config)
|
||||
public CoreConfigClashService(Config config)
|
||||
{
|
||||
_config = config;
|
||||
}
|
|
@ -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()
|
||||
{
|
|
@ -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())
|
||||
{
|
|
@ -3,12 +3,12 @@ using System.Net;
|
|||
using System.Net.Http.Headers;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace ServiceLib.Handler
|
||||
namespace ServiceLib.Services
|
||||
{
|
||||
/// <summary>
|
||||
///Download
|
||||
/// </summary>
|
||||
public class DownloadHandler
|
||||
public class DownloadService
|
||||
{
|
||||
public event EventHandler<ResultEventArgs>? UpdateCompleted;
|
||||
|
|
@ -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<SpeedTestResult> _updateFunc;
|
||||
private bool _exitLoop = false;
|
||||
|
||||
public SpeedtestHandler(Config config, CoreHandler coreHandler, List<ProfileItem> selecteds, ESpeedActionType actionType, Action<SpeedTestResult> update)
|
||||
public SpeedtestService(Config config, CoreHandler coreHandler, List<ProfileItem> selecteds, ESpeedActionType actionType, Action<SpeedTestResult> update)
|
||||
{
|
||||
_config = config;
|
||||
_coreHandler = coreHandler;
|
||||
|
@ -144,7 +144,7 @@ namespace ServiceLib.Handler
|
|||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
DownloadHandler downloadHandle = new DownloadHandler();
|
||||
DownloadService downloadHandle = new DownloadService();
|
||||
|
||||
List<Task> 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<string> GetRealPingTime(DownloadHandler downloadHandle, IWebProxy webProxy)
|
||||
private async Task<string> 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];
|
||||
}
|
||||
|
|
@ -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<ServerSpeedItem> _updateFunc;
|
||||
|
||||
public StatisticsSingbox(Config config, Action<ServerSpeedItem> update)
|
||||
public StatisticsSingboxService(Config config, Action<ServerSpeedItem> 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;
|
||||
}
|
|
@ -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<ServerSpeedItem> _updateFunc;
|
||||
|
||||
public StatisticsV2ray(Models.Config config, Action<ServerSpeedItem> update)
|
||||
public StatisticsV2rayService(Models.Config config, Action<ServerSpeedItem> 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;
|
||||
}
|
|
@ -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<bool, string> _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<bool, string> 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<ResultEventArgs> CheckUpdateAsync(DownloadHandler downloadHandle, ECoreType type, bool preRelease)
|
||||
private async Task<ResultEventArgs> 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)
|
|
@ -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, "");
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<string, bool> _dicHeaderSort = new();
|
||||
private SpeedtestHandler? _speedtestHandler;
|
||||
private SpeedtestService? _speedtestHandler;
|
||||
|
||||
#endregion private prop
|
||||
|
||||
|
@ -670,7 +671,7 @@ namespace ServiceLib.ViewModels
|
|||
var coreHandler = Locator.Current.GetService<CoreHandler>();
|
||||
if (coreHandler != null)
|
||||
{
|
||||
_speedtestHandler = new SpeedtestHandler(_config, coreHandler, lstSelecteds, actionType, UpdateSpeedtestHandler);
|
||||
_speedtestHandler = new SpeedtestService(_config, coreHandler, lstSelecteds, actionType, UpdateSpeedtestHandler);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue