mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-28 02:52:53 +00:00
Compare commits
5 commits
abdafc9b3b
...
a108eaf34b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a108eaf34b | ||
|
|
da28c639b3 | ||
|
|
8ef68127d4 | ||
|
|
f39d966a33 | ||
|
|
f83e83de13 |
14 changed files with 176 additions and 160 deletions
|
|
@ -2,17 +2,18 @@ namespace ServiceLib.Handler;
|
||||||
|
|
||||||
public static class SubscriptionHandler
|
public static class SubscriptionHandler
|
||||||
{
|
{
|
||||||
public static async Task UpdateProcess(Config config, string subId, bool blProxy, Action<bool, string> updateFunc)
|
public static async Task UpdateProcess(Config config, string subId, bool blProxy, Func<bool, string, Task> updateFunc)
|
||||||
{
|
{
|
||||||
updateFunc?.Invoke(false, ResUI.MsgUpdateSubscriptionStart);
|
await updateFunc?.Invoke(false, ResUI.MsgUpdateSubscriptionStart);
|
||||||
var subItem = await AppManager.Instance.SubItems();
|
var subItem = await AppManager.Instance.SubItems();
|
||||||
|
|
||||||
if (subItem is not { Count: > 0 })
|
if (subItem is not { Count: > 0 })
|
||||||
{
|
{
|
||||||
updateFunc?.Invoke(false, ResUI.MsgNoValidSubscription);
|
await updateFunc?.Invoke(false, ResUI.MsgNoValidSubscription);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var successCount = 0;
|
||||||
foreach (var item in subItem)
|
foreach (var item in subItem)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -25,32 +26,35 @@ public static class SubscriptionHandler
|
||||||
var hashCode = $"{item.Remarks}->";
|
var hashCode = $"{item.Remarks}->";
|
||||||
if (item.Enabled == false)
|
if (item.Enabled == false)
|
||||||
{
|
{
|
||||||
updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgSkipSubscriptionUpdate}");
|
await updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgSkipSubscriptionUpdate}");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create download handler
|
// Create download handler
|
||||||
var downloadHandle = CreateDownloadHandler(hashCode, updateFunc);
|
var downloadHandle = CreateDownloadHandler(hashCode, updateFunc);
|
||||||
updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgStartGettingSubscriptions}");
|
await updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgStartGettingSubscriptions}");
|
||||||
|
|
||||||
// Get all subscription content (main subscription + additional subscriptions)
|
// Get all subscription content (main subscription + additional subscriptions)
|
||||||
var result = await DownloadAllSubscriptions(config, item, blProxy, downloadHandle);
|
var result = await DownloadAllSubscriptions(config, item, blProxy, downloadHandle);
|
||||||
|
|
||||||
// Process download result
|
// Process download result
|
||||||
await ProcessDownloadResult(config, item.Id, result, hashCode, updateFunc);
|
if (await ProcessDownloadResult(config, item.Id, result, hashCode, updateFunc))
|
||||||
|
{
|
||||||
|
successCount++;
|
||||||
|
}
|
||||||
|
|
||||||
updateFunc?.Invoke(false, "-------------------------------------------------------");
|
await updateFunc?.Invoke(false, "-------------------------------------------------------");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
var hashCode = $"{item.Remarks}->";
|
var hashCode = $"{item.Remarks}->";
|
||||||
Logging.SaveLog("UpdateSubscription", ex);
|
Logging.SaveLog("UpdateSubscription", ex);
|
||||||
updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgFailedImportSubscription}: {ex.Message}");
|
await updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgFailedImportSubscription}: {ex.Message}");
|
||||||
updateFunc?.Invoke(false, "-------------------------------------------------------");
|
await updateFunc?.Invoke(false, "-------------------------------------------------------");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFunc?.Invoke(true, $"{ResUI.MsgUpdateSubscriptionEnd}");
|
await updateFunc?.Invoke(successCount > 0, $"{ResUI.MsgUpdateSubscriptionEnd}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsValidSubscription(SubItem item, string subId)
|
private static bool IsValidSubscription(SubItem item, string subId)
|
||||||
|
|
@ -76,7 +80,7 @@ public static class SubscriptionHandler
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static DownloadService CreateDownloadHandler(string hashCode, Action<bool, string> updateFunc)
|
private static DownloadService CreateDownloadHandler(string hashCode, Func<bool, string, Task> updateFunc)
|
||||||
{
|
{
|
||||||
var downloadHandle = new DownloadService();
|
var downloadHandle = new DownloadService();
|
||||||
downloadHandle.Error += (sender2, args) =>
|
downloadHandle.Error += (sender2, args) =>
|
||||||
|
|
@ -181,23 +185,23 @@ public static class SubscriptionHandler
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task ProcessDownloadResult(Config config, string id, string result, string hashCode, Action<bool, string> updateFunc)
|
private static async Task<bool> ProcessDownloadResult(Config config, string id, string result, string hashCode, Func<bool, string, Task> updateFunc)
|
||||||
{
|
{
|
||||||
if (result.IsNullOrEmpty())
|
if (result.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgSubscriptionDecodingFailed}");
|
await updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgSubscriptionDecodingFailed}");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgGetSubscriptionSuccessfully}");
|
await updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgGetSubscriptionSuccessfully}");
|
||||||
|
|
||||||
// If result is too short, display content directly
|
// If result is too short, display content directly
|
||||||
if (result.Length < 99)
|
if (result.Length < 99)
|
||||||
{
|
{
|
||||||
updateFunc?.Invoke(false, $"{hashCode}{result}");
|
await updateFunc?.Invoke(false, $"{hashCode}{result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgStartParsingSubscription}");
|
await updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgStartParsingSubscription}");
|
||||||
|
|
||||||
// Add servers to configuration
|
// Add servers to configuration
|
||||||
var ret = await ConfigHandler.AddBatchServers(config, result, id, true);
|
var ret = await ConfigHandler.AddBatchServers(config, result, id, true);
|
||||||
|
|
@ -208,9 +212,10 @@ public static class SubscriptionHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update completion message
|
// Update completion message
|
||||||
updateFunc?.Invoke(false,
|
await updateFunc?.Invoke(false, ret > 0
|
||||||
ret > 0
|
|
||||||
? $"{hashCode}{ResUI.MsgUpdateSubscriptionEnd}"
|
? $"{hashCode}{ResUI.MsgUpdateSubscriptionEnd}"
|
||||||
: $"{hashCode}{ResUI.MsgFailedImportSubscription}");
|
: $"{hashCode}{ResUI.MsgFailedImportSubscription}");
|
||||||
|
|
||||||
|
return ret > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public sealed class ClashApiManager
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClashProxiesDelayTest(bool blAll, List<ClashProxyModel> lstProxy, Action<ClashProxyModel?, string> updateFunc)
|
public void ClashProxiesDelayTest(bool blAll, List<ClashProxyModel> lstProxy, Func<ClashProxyModel?, string, Task> updateFunc)
|
||||||
{
|
{
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
|
|
@ -79,12 +79,12 @@ public sealed class ClashApiManager
|
||||||
tasks.Add(Task.Run(async () =>
|
tasks.Add(Task.Run(async () =>
|
||||||
{
|
{
|
||||||
var result = await HttpClientHelper.Instance.TryGetAsync(url);
|
var result = await HttpClientHelper.Instance.TryGetAsync(url);
|
||||||
updateFunc?.Invoke(it, result);
|
await updateFunc?.Invoke(it, result);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
await Task.WhenAll(tasks);
|
await Task.WhenAll(tasks);
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
updateFunc?.Invoke(null, "");
|
await updateFunc?.Invoke(null, "");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,11 @@ public class CoreAdminManager
|
||||||
private static readonly Lazy<CoreAdminManager> _instance = new(() => new());
|
private static readonly Lazy<CoreAdminManager> _instance = new(() => new());
|
||||||
public static CoreAdminManager Instance => _instance.Value;
|
public static CoreAdminManager Instance => _instance.Value;
|
||||||
private Config _config;
|
private Config _config;
|
||||||
private Action<bool, string>? _updateFunc;
|
private Func<bool, string, Task>? _updateFunc;
|
||||||
private int _linuxSudoPid = -1;
|
private int _linuxSudoPid = -1;
|
||||||
private const string _tag = "CoreAdminHandler";
|
private const string _tag = "CoreAdminHandler";
|
||||||
|
|
||||||
public async Task Init(Config config, Action<bool, string> updateFunc)
|
public async Task Init(Config config, Func<bool, string, Task> updateFunc)
|
||||||
{
|
{
|
||||||
if (_config != null)
|
if (_config != null)
|
||||||
{
|
{
|
||||||
|
|
@ -26,9 +26,9 @@ public class CoreAdminManager
|
||||||
await Task.CompletedTask;
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateFunc(bool notify, string msg)
|
private async Task UpdateFunc(bool notify, string msg)
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(notify, msg);
|
await _updateFunc?.Invoke(notify, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Process?> RunProcessAsLinuxSudo(string fileName, CoreInfo coreInfo, string configPath)
|
public async Task<Process?> RunProcessAsLinuxSudo(string fileName, CoreInfo coreInfo, string configPath)
|
||||||
|
|
@ -60,7 +60,7 @@ public class CoreAdminManager
|
||||||
{
|
{
|
||||||
if (e.Data.IsNotEmpty())
|
if (e.Data.IsNotEmpty())
|
||||||
{
|
{
|
||||||
UpdateFunc(false, e.Data + Environment.NewLine);
|
_ = UpdateFunc(false, e.Data + Environment.NewLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -106,7 +106,7 @@ public class CoreAdminManager
|
||||||
.WithStandardInputPipe(PipeSource.FromString(AppManager.Instance.LinuxSudoPwd))
|
.WithStandardInputPipe(PipeSource.FromString(AppManager.Instance.LinuxSudoPwd))
|
||||||
.ExecuteBufferedAsync();
|
.ExecuteBufferedAsync();
|
||||||
|
|
||||||
UpdateFunc(false, result.StandardOutput.ToString());
|
await UpdateFunc(false, result.StandardOutput.ToString());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,10 @@ public class CoreManager
|
||||||
private Process? _process;
|
private Process? _process;
|
||||||
private Process? _processPre;
|
private Process? _processPre;
|
||||||
private bool _linuxSudo = false;
|
private bool _linuxSudo = false;
|
||||||
private Action<bool, string>? _updateFunc;
|
private Func<bool, string, Task>? _updateFunc;
|
||||||
private const string _tag = "CoreHandler";
|
private const string _tag = "CoreHandler";
|
||||||
|
|
||||||
public async Task Init(Config config, Action<bool, string> updateFunc)
|
public async Task Init(Config config, Func<bool, string, Task> updateFunc)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_updateFunc = updateFunc;
|
_updateFunc = updateFunc;
|
||||||
|
|
@ -63,7 +63,7 @@ public class CoreManager
|
||||||
{
|
{
|
||||||
if (node == null)
|
if (node == null)
|
||||||
{
|
{
|
||||||
UpdateFunc(false, ResUI.CheckServerSettings);
|
await UpdateFunc(false, ResUI.CheckServerSettings);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,13 +71,13 @@ public class CoreManager
|
||||||
var result = await CoreConfigHandler.GenerateClientConfig(node, fileName);
|
var result = await CoreConfigHandler.GenerateClientConfig(node, fileName);
|
||||||
if (result.Success != true)
|
if (result.Success != true)
|
||||||
{
|
{
|
||||||
UpdateFunc(true, result.Msg);
|
await UpdateFunc(true, result.Msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateFunc(false, $"{node.GetSummary()}");
|
await UpdateFunc(false, $"{node.GetSummary()}");
|
||||||
UpdateFunc(false, $"{Utils.GetRuntimeInfo()}");
|
await UpdateFunc(false, $"{Utils.GetRuntimeInfo()}");
|
||||||
UpdateFunc(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")));
|
await UpdateFunc(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")));
|
||||||
await CoreStop();
|
await CoreStop();
|
||||||
await Task.Delay(100);
|
await Task.Delay(100);
|
||||||
|
|
||||||
|
|
@ -91,7 +91,7 @@ public class CoreManager
|
||||||
await CoreStartPreService(node);
|
await CoreStartPreService(node);
|
||||||
if (_process != null)
|
if (_process != null)
|
||||||
{
|
{
|
||||||
UpdateFunc(true, $"{node.GetSummary()}");
|
await UpdateFunc(true, $"{node.GetSummary()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -101,14 +101,14 @@ public class CoreManager
|
||||||
var fileName = string.Format(Global.CoreSpeedtestConfigFileName, Utils.GetGuid(false));
|
var fileName = string.Format(Global.CoreSpeedtestConfigFileName, Utils.GetGuid(false));
|
||||||
var configPath = Utils.GetBinConfigPath(fileName);
|
var configPath = Utils.GetBinConfigPath(fileName);
|
||||||
var result = await CoreConfigHandler.GenerateClientSpeedtestConfig(_config, configPath, selecteds, coreType);
|
var result = await CoreConfigHandler.GenerateClientSpeedtestConfig(_config, configPath, selecteds, coreType);
|
||||||
UpdateFunc(false, result.Msg);
|
await UpdateFunc(false, result.Msg);
|
||||||
if (result.Success != true)
|
if (result.Success != true)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateFunc(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")));
|
await UpdateFunc(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")));
|
||||||
UpdateFunc(false, configPath);
|
await UpdateFunc(false, configPath);
|
||||||
|
|
||||||
var coreInfo = CoreInfoManager.Instance.GetCoreInfo(coreType);
|
var coreInfo = CoreInfoManager.Instance.GetCoreInfo(coreType);
|
||||||
var proc = await RunProcess(coreInfo, fileName, true, false);
|
var proc = await RunProcess(coreInfo, fileName, true, false);
|
||||||
|
|
@ -216,9 +216,9 @@ public class CoreManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateFunc(bool notify, string msg)
|
private async Task UpdateFunc(bool notify, string msg)
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(notify, msg);
|
await _updateFunc?.Invoke(notify, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Private
|
#endregion Private
|
||||||
|
|
@ -230,7 +230,7 @@ public class CoreManager
|
||||||
var fileName = CoreInfoManager.Instance.GetCoreExecFile(coreInfo, out var msg);
|
var fileName = CoreInfoManager.Instance.GetCoreExecFile(coreInfo, out var msg);
|
||||||
if (fileName.IsNullOrEmpty())
|
if (fileName.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
UpdateFunc(false, msg);
|
await UpdateFunc(false, msg);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -251,7 +251,7 @@ public class CoreManager
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.SaveLog(_tag, ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
UpdateFunc(mayNeedSudo, ex.Message);
|
await UpdateFunc(mayNeedSudo, ex.Message);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -284,7 +284,7 @@ public class CoreManager
|
||||||
{
|
{
|
||||||
if (e.Data.IsNotEmpty())
|
if (e.Data.IsNotEmpty())
|
||||||
{
|
{
|
||||||
UpdateFunc(false, e.Data + Environment.NewLine);
|
_ = UpdateFunc(false, e.Data + Environment.NewLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
proc.OutputDataReceived += dataHandler;
|
proc.OutputDataReceived += dataHandler;
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,14 @@ public class StatisticsManager
|
||||||
private Config _config;
|
private Config _config;
|
||||||
private ServerStatItem? _serverStatItem;
|
private ServerStatItem? _serverStatItem;
|
||||||
private List<ServerStatItem> _lstServerStat;
|
private List<ServerStatItem> _lstServerStat;
|
||||||
private Action<ServerSpeedItem>? _updateFunc;
|
private Func<ServerSpeedItem, Task>? _updateFunc;
|
||||||
|
|
||||||
private StatisticsXrayService? _statisticsXray;
|
private StatisticsXrayService? _statisticsXray;
|
||||||
private StatisticsSingboxService? _statisticsSingbox;
|
private StatisticsSingboxService? _statisticsSingbox;
|
||||||
private static readonly string _tag = "StatisticsHandler";
|
private static readonly string _tag = "StatisticsHandler";
|
||||||
public List<ServerStatItem> ServerStat => _lstServerStat;
|
public List<ServerStatItem> ServerStat => _lstServerStat;
|
||||||
|
|
||||||
public async Task Init(Config config, Action<ServerSpeedItem> updateFunc)
|
public async Task Init(Config config, Func<ServerSpeedItem, Task> updateFunc)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_updateFunc = updateFunc;
|
_updateFunc = updateFunc;
|
||||||
|
|
@ -97,9 +97,9 @@ public class StatisticsManager
|
||||||
_lstServerStat = await SQLiteHelper.Instance.TableAsync<ServerStatItem>().ToListAsync();
|
_lstServerStat = await SQLiteHelper.Instance.TableAsync<ServerStatItem>().ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateServerStatHandler(ServerSpeedItem server)
|
private async Task UpdateServerStatHandler(ServerSpeedItem server)
|
||||||
{
|
{
|
||||||
_ = UpdateServerStat(server);
|
await UpdateServerStat(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateServerStat(ServerSpeedItem server)
|
private async Task UpdateServerStat(ServerSpeedItem server)
|
||||||
|
|
@ -123,7 +123,7 @@ public class StatisticsManager
|
||||||
server.TodayDown = _serverStatItem.TodayDown;
|
server.TodayDown = _serverStatItem.TodayDown;
|
||||||
server.TotalUp = _serverStatItem.TotalUp;
|
server.TotalUp = _serverStatItem.TotalUp;
|
||||||
server.TotalDown = _serverStatItem.TotalDown;
|
server.TotalDown = _serverStatItem.TotalDown;
|
||||||
_updateFunc?.Invoke(server);
|
await _updateFunc?.Invoke(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task GetServerStatItem(string indexId)
|
private async Task GetServerStatItem(string indexId)
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,18 @@ public class TaskManager
|
||||||
{
|
{
|
||||||
private static readonly Lazy<TaskManager> _instance = new(() => new());
|
private static readonly Lazy<TaskManager> _instance = new(() => new());
|
||||||
public static TaskManager Instance => _instance.Value;
|
public static TaskManager Instance => _instance.Value;
|
||||||
|
private Config _config;
|
||||||
|
private Func<bool, string, Task>? _updateFunc;
|
||||||
|
|
||||||
public void RegUpdateTask(Config config, Action<bool, string> updateFunc)
|
public void RegUpdateTask(Config config, Func<bool, string, Task> updateFunc)
|
||||||
{
|
{
|
||||||
Task.Run(() => ScheduledTasks(config, updateFunc));
|
_config = config;
|
||||||
|
_updateFunc = updateFunc;
|
||||||
|
|
||||||
|
Task.Run(ScheduledTasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ScheduledTasks(Config config, Action<bool, string> updateFunc)
|
private async Task ScheduledTasks()
|
||||||
{
|
{
|
||||||
Logging.SaveLog("Setup Scheduled Tasks");
|
Logging.SaveLog("Setup Scheduled Tasks");
|
||||||
|
|
||||||
|
|
@ -21,14 +26,14 @@ public class TaskManager
|
||||||
await Task.Delay(1000 * 60);
|
await Task.Delay(1000 * 60);
|
||||||
|
|
||||||
//Execute once 1 minute
|
//Execute once 1 minute
|
||||||
await UpdateTaskRunSubscription(config, updateFunc);
|
await UpdateTaskRunSubscription();
|
||||||
|
|
||||||
//Execute once 20 minute
|
//Execute once 20 minute
|
||||||
if (numOfExecuted % 20 == 0)
|
if (numOfExecuted % 20 == 0)
|
||||||
{
|
{
|
||||||
//Logging.SaveLog("Execute save config");
|
//Logging.SaveLog("Execute save config");
|
||||||
|
|
||||||
await ConfigHandler.SaveConfig(config);
|
await ConfigHandler.SaveConfig(_config);
|
||||||
await ProfileExManager.Instance.SaveTo();
|
await ProfileExManager.Instance.SaveTo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,14 +47,14 @@ public class TaskManager
|
||||||
FileManager.DeleteExpiredFiles(Utils.GetTempPath(), DateTime.Now.AddMonths(-1));
|
FileManager.DeleteExpiredFiles(Utils.GetTempPath(), DateTime.Now.AddMonths(-1));
|
||||||
|
|
||||||
//Check once 1 hour
|
//Check once 1 hour
|
||||||
await UpdateTaskRunGeo(config, numOfExecuted / 60, updateFunc);
|
await UpdateTaskRunGeo(numOfExecuted / 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
numOfExecuted++;
|
numOfExecuted++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateTaskRunSubscription(Config config, Action<bool, string> updateFunc)
|
private async Task UpdateTaskRunSubscription()
|
||||||
{
|
{
|
||||||
var updateTime = ((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds();
|
var updateTime = ((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds();
|
||||||
var lstSubs = (await AppManager.Instance.SubItems())?
|
var lstSubs = (await AppManager.Instance.SubItems())?
|
||||||
|
|
@ -66,30 +71,30 @@ public class TaskManager
|
||||||
|
|
||||||
foreach (var item in lstSubs)
|
foreach (var item in lstSubs)
|
||||||
{
|
{
|
||||||
await SubscriptionHandler.UpdateProcess(config, item.Id, true, (success, msg) =>
|
await SubscriptionHandler.UpdateProcess(_config, item.Id, true, async (success, msg) =>
|
||||||
{
|
{
|
||||||
updateFunc?.Invoke(success, msg);
|
await _updateFunc?.Invoke(success, msg);
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
Logging.SaveLog($"Update subscription end. {msg}");
|
Logging.SaveLog($"Update subscription end. {msg}");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
item.UpdateTime = updateTime;
|
item.UpdateTime = updateTime;
|
||||||
await ConfigHandler.AddSubItem(config, item);
|
await ConfigHandler.AddSubItem(_config, item);
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateTaskRunGeo(Config config, int hours, Action<bool, string> updateFunc)
|
private async Task UpdateTaskRunGeo(int hours)
|
||||||
{
|
{
|
||||||
if (config.GuiItem.AutoUpdateInterval > 0 && hours > 0 && hours % config.GuiItem.AutoUpdateInterval == 0)
|
if (_config.GuiItem.AutoUpdateInterval > 0 && hours > 0 && hours % _config.GuiItem.AutoUpdateInterval == 0)
|
||||||
{
|
{
|
||||||
Logging.SaveLog("Execute update geo files");
|
Logging.SaveLog("Execute update geo files");
|
||||||
|
|
||||||
var updateHandle = new UpdateService();
|
var updateHandle = new UpdateService();
|
||||||
await updateHandle.UpdateGeoFileAll(config, (success, msg) =>
|
await updateHandle.UpdateGeoFileAll(_config, async (success, msg) =>
|
||||||
{
|
{
|
||||||
updateFunc?.Invoke(false, msg);
|
await _updateFunc?.Invoke(false, msg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ public class DownloadService
|
||||||
|
|
||||||
private static readonly string _tag = "DownloadService";
|
private static readonly string _tag = "DownloadService";
|
||||||
|
|
||||||
public async Task<int> DownloadDataAsync(string url, WebProxy webProxy, int downloadTimeout, Action<bool, string> updateFunc)
|
public async Task<int> DownloadDataAsync(string url, WebProxy webProxy, int downloadTimeout, Func<bool, string, Task> updateFunc)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -31,10 +31,10 @@ public class DownloadService
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
updateFunc?.Invoke(false, ex.Message);
|
await updateFunc?.Invoke(false, ex.Message);
|
||||||
if (ex.InnerException != null)
|
if (ex.InnerException != null)
|
||||||
{
|
{
|
||||||
updateFunc?.Invoke(false, ex.InnerException.Message);
|
await updateFunc?.Invoke(false, ex.InnerException.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -5,26 +5,20 @@ using System.Net.Sockets;
|
||||||
|
|
||||||
namespace ServiceLib.Services;
|
namespace ServiceLib.Services;
|
||||||
|
|
||||||
public class SpeedtestService
|
public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateFunc)
|
||||||
{
|
{
|
||||||
private static readonly string _tag = "SpeedtestService";
|
private static readonly string _tag = "SpeedtestService";
|
||||||
private Config? _config;
|
private readonly Config? _config = config;
|
||||||
private Action<SpeedTestResult>? _updateFunc;
|
private readonly Func<SpeedTestResult, Task>? _updateFunc = updateFunc;
|
||||||
private static readonly ConcurrentBag<string> _lstExitLoop = new();
|
private static readonly ConcurrentBag<string> _lstExitLoop = new();
|
||||||
|
|
||||||
public SpeedtestService(Config config, Action<SpeedTestResult> updateFunc)
|
|
||||||
{
|
|
||||||
_config = config;
|
|
||||||
_updateFunc = updateFunc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RunLoop(ESpeedActionType actionType, List<ProfileItem> selecteds)
|
public void RunLoop(ESpeedActionType actionType, List<ProfileItem> selecteds)
|
||||||
{
|
{
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
await RunAsync(actionType, selecteds);
|
await RunAsync(actionType, selecteds);
|
||||||
await ProfileExManager.Instance.SaveTo();
|
await ProfileExManager.Instance.SaveTo();
|
||||||
UpdateFunc("", ResUI.SpeedtestingCompleted);
|
await UpdateFunc("", ResUI.SpeedtestingCompleted);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,7 +37,7 @@ public class SpeedtestService
|
||||||
var exitLoopKey = Utils.GetGuid(false);
|
var exitLoopKey = Utils.GetGuid(false);
|
||||||
_lstExitLoop.Add(exitLoopKey);
|
_lstExitLoop.Add(exitLoopKey);
|
||||||
|
|
||||||
var lstSelected = GetClearItem(actionType, selecteds);
|
var lstSelected = await GetClearItem(actionType, selecteds);
|
||||||
|
|
||||||
switch (actionType)
|
switch (actionType)
|
||||||
{
|
{
|
||||||
|
|
@ -65,7 +59,7 @@ public class SpeedtestService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ServerTestItem> GetClearItem(ESpeedActionType actionType, List<ProfileItem> selecteds)
|
private async Task<List<ServerTestItem>> GetClearItem(ESpeedActionType actionType, List<ProfileItem> selecteds)
|
||||||
{
|
{
|
||||||
var lstSelected = new List<ServerTestItem>();
|
var lstSelected = new List<ServerTestItem>();
|
||||||
foreach (var it in selecteds)
|
foreach (var it in selecteds)
|
||||||
|
|
@ -97,17 +91,17 @@ public class SpeedtestService
|
||||||
{
|
{
|
||||||
case ESpeedActionType.Tcping:
|
case ESpeedActionType.Tcping:
|
||||||
case ESpeedActionType.Realping:
|
case ESpeedActionType.Realping:
|
||||||
UpdateFunc(it.IndexId, ResUI.Speedtesting, "");
|
await UpdateFunc(it.IndexId, ResUI.Speedtesting, "");
|
||||||
ProfileExManager.Instance.SetTestDelay(it.IndexId, 0);
|
ProfileExManager.Instance.SetTestDelay(it.IndexId, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESpeedActionType.Speedtest:
|
case ESpeedActionType.Speedtest:
|
||||||
UpdateFunc(it.IndexId, "", ResUI.SpeedtestingWait);
|
await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingWait);
|
||||||
ProfileExManager.Instance.SetTestSpeed(it.IndexId, 0);
|
ProfileExManager.Instance.SetTestSpeed(it.IndexId, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESpeedActionType.Mixedtest:
|
case ESpeedActionType.Mixedtest:
|
||||||
UpdateFunc(it.IndexId, ResUI.Speedtesting, ResUI.SpeedtestingWait);
|
await UpdateFunc(it.IndexId, ResUI.Speedtesting, ResUI.SpeedtestingWait);
|
||||||
ProfileExManager.Instance.SetTestDelay(it.IndexId, 0);
|
ProfileExManager.Instance.SetTestDelay(it.IndexId, 0);
|
||||||
ProfileExManager.Instance.SetTestSpeed(it.IndexId, 0);
|
ProfileExManager.Instance.SetTestSpeed(it.IndexId, 0);
|
||||||
break;
|
break;
|
||||||
|
|
@ -133,7 +127,7 @@ public class SpeedtestService
|
||||||
var responseTime = await GetTcpingTime(it.Address, it.Port);
|
var responseTime = await GetTcpingTime(it.Address, it.Port);
|
||||||
|
|
||||||
ProfileExManager.Instance.SetTestDelay(it.IndexId, responseTime);
|
ProfileExManager.Instance.SetTestDelay(it.IndexId, responseTime);
|
||||||
UpdateFunc(it.IndexId, responseTime.ToString());
|
await UpdateFunc(it.IndexId, responseTime.ToString());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
@ -169,11 +163,11 @@ public class SpeedtestService
|
||||||
{
|
{
|
||||||
if (_lstExitLoop.Any(p => p == exitLoopKey) == false)
|
if (_lstExitLoop.Any(p => p == exitLoopKey) == false)
|
||||||
{
|
{
|
||||||
UpdateFunc("", ResUI.SpeedtestingSkip);
|
await UpdateFunc("", ResUI.SpeedtestingSkip);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateFunc("", string.Format(ResUI.SpeedtestingTestFailedPart, lstFailed.Count));
|
await UpdateFunc("", string.Format(ResUI.SpeedtestingTestFailedPart, lstFailed.Count));
|
||||||
|
|
||||||
if (pageSizeNext > _config.SpeedTestItem.MixedConcurrencyCount)
|
if (pageSizeNext > _config.SpeedTestItem.MixedConcurrencyCount)
|
||||||
{
|
{
|
||||||
|
|
@ -239,7 +233,7 @@ public class SpeedtestService
|
||||||
{
|
{
|
||||||
if (_lstExitLoop.Any(p => p == exitLoopKey) == false)
|
if (_lstExitLoop.Any(p => p == exitLoopKey) == false)
|
||||||
{
|
{
|
||||||
UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip);
|
await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (it.ConfigType == EConfigType.Custom)
|
if (it.ConfigType == EConfigType.Custom)
|
||||||
|
|
@ -256,7 +250,7 @@ public class SpeedtestService
|
||||||
pid = await CoreManager.Instance.LoadCoreConfigSpeedtest(it);
|
pid = await CoreManager.Instance.LoadCoreConfigSpeedtest(it);
|
||||||
if (pid < 0)
|
if (pid < 0)
|
||||||
{
|
{
|
||||||
UpdateFunc(it.IndexId, "", ResUI.FailedToRunCore);
|
await UpdateFunc(it.IndexId, "", ResUI.FailedToRunCore);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -270,7 +264,7 @@ public class SpeedtestService
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip);
|
await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -298,25 +292,25 @@ public class SpeedtestService
|
||||||
var responseTime = await HttpClientHelper.Instance.GetRealPingTime(_config.SpeedTestItem.SpeedPingTestUrl, webProxy, 10);
|
var responseTime = await HttpClientHelper.Instance.GetRealPingTime(_config.SpeedTestItem.SpeedPingTestUrl, webProxy, 10);
|
||||||
|
|
||||||
ProfileExManager.Instance.SetTestDelay(it.IndexId, responseTime);
|
ProfileExManager.Instance.SetTestDelay(it.IndexId, responseTime);
|
||||||
UpdateFunc(it.IndexId, responseTime.ToString());
|
await UpdateFunc(it.IndexId, responseTime.ToString());
|
||||||
return responseTime;
|
return responseTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DoSpeedTest(DownloadService downloadHandle, ServerTestItem it)
|
private async Task DoSpeedTest(DownloadService downloadHandle, ServerTestItem it)
|
||||||
{
|
{
|
||||||
UpdateFunc(it.IndexId, "", ResUI.Speedtesting);
|
await UpdateFunc(it.IndexId, "", ResUI.Speedtesting);
|
||||||
|
|
||||||
var webProxy = new WebProxy($"socks5://{Global.Loopback}:{it.Port}");
|
var webProxy = new WebProxy($"socks5://{Global.Loopback}:{it.Port}");
|
||||||
var url = _config.SpeedTestItem.SpeedTestUrl;
|
var url = _config.SpeedTestItem.SpeedTestUrl;
|
||||||
var timeout = _config.SpeedTestItem.SpeedTestTimeout;
|
var timeout = _config.SpeedTestItem.SpeedTestTimeout;
|
||||||
await downloadHandle.DownloadDataAsync(url, webProxy, timeout, (success, msg) =>
|
await downloadHandle.DownloadDataAsync(url, webProxy, timeout, async (success, msg) =>
|
||||||
{
|
{
|
||||||
decimal.TryParse(msg, out var dec);
|
decimal.TryParse(msg, out var dec);
|
||||||
if (dec > 0)
|
if (dec > 0)
|
||||||
{
|
{
|
||||||
ProfileExManager.Instance.SetTestSpeed(it.IndexId, dec);
|
ProfileExManager.Instance.SetTestSpeed(it.IndexId, dec);
|
||||||
}
|
}
|
||||||
UpdateFunc(it.IndexId, "", msg);
|
await UpdateFunc(it.IndexId, "", msg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -371,9 +365,9 @@ public class SpeedtestService
|
||||||
return lstTest;
|
return lstTest;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateFunc(string indexId, string delay, string speed = "")
|
private async Task UpdateFunc(string indexId, string delay, string speed = "")
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(new() { IndexId = indexId, Delay = delay, Speed = speed });
|
await _updateFunc?.Invoke(new() { IndexId = indexId, Delay = delay, Speed = speed });
|
||||||
if (indexId.IsNotEmpty() && speed.IsNotEmpty())
|
if (indexId.IsNotEmpty() && speed.IsNotEmpty())
|
||||||
{
|
{
|
||||||
ProfileExManager.Instance.SetTestMessage(indexId, speed);
|
ProfileExManager.Instance.SetTestMessage(indexId, speed);
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,11 @@ public class StatisticsSingboxService
|
||||||
private readonly Config _config;
|
private readonly Config _config;
|
||||||
private bool _exitFlag;
|
private bool _exitFlag;
|
||||||
private ClientWebSocket? webSocket;
|
private ClientWebSocket? webSocket;
|
||||||
private Action<ServerSpeedItem>? _updateFunc;
|
private readonly Func<ServerSpeedItem, Task>? _updateFunc;
|
||||||
private string Url => $"ws://{Global.Loopback}:{AppManager.Instance.StatePort2}/traffic";
|
private string Url => $"ws://{Global.Loopback}:{AppManager.Instance.StatePort2}/traffic";
|
||||||
private static readonly string _tag = "StatisticsSingboxService";
|
private static readonly string _tag = "StatisticsSingboxService";
|
||||||
|
|
||||||
public StatisticsSingboxService(Config config, Action<ServerSpeedItem> updateFunc)
|
public StatisticsSingboxService(Config config, Func<ServerSpeedItem, Task> updateFunc)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_updateFunc = updateFunc;
|
_updateFunc = updateFunc;
|
||||||
|
|
@ -90,7 +90,7 @@ public class StatisticsSingboxService
|
||||||
{
|
{
|
||||||
ParseOutput(result, out var up, out var down);
|
ParseOutput(result, out var up, out var down);
|
||||||
|
|
||||||
_updateFunc?.Invoke(new ServerSpeedItem()
|
await _updateFunc?.Invoke(new ServerSpeedItem()
|
||||||
{
|
{
|
||||||
ProxyUp = (long)(up / 1000),
|
ProxyUp = (long)(up / 1000),
|
||||||
ProxyDown = (long)(down / 1000)
|
ProxyDown = (long)(down / 1000)
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@ public class StatisticsXrayService
|
||||||
private ServerSpeedItem _serverSpeedItem = new();
|
private ServerSpeedItem _serverSpeedItem = new();
|
||||||
private readonly Config _config;
|
private readonly Config _config;
|
||||||
private bool _exitFlag;
|
private bool _exitFlag;
|
||||||
private Action<ServerSpeedItem>? _updateFunc;
|
private readonly Func<ServerSpeedItem, Task>? _updateFunc;
|
||||||
private string Url => $"{Global.HttpProtocol}{Global.Loopback}:{AppManager.Instance.StatePort}/debug/vars";
|
private string Url => $"{Global.HttpProtocol}{Global.Loopback}:{AppManager.Instance.StatePort}/debug/vars";
|
||||||
|
|
||||||
public StatisticsXrayService(Config config, Action<ServerSpeedItem> updateFunc)
|
public StatisticsXrayService(Config config, Func<ServerSpeedItem, Task> updateFunc)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_updateFunc = updateFunc;
|
_updateFunc = updateFunc;
|
||||||
|
|
@ -39,7 +39,7 @@ public class StatisticsXrayService
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
var server = ParseOutput(result) ?? new ServerSpeedItem();
|
var server = ParseOutput(result) ?? new ServerSpeedItem();
|
||||||
_updateFunc?.Invoke(server);
|
await _updateFunc?.Invoke(server);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ namespace ServiceLib.Services;
|
||||||
|
|
||||||
public class UpdateService
|
public class UpdateService
|
||||||
{
|
{
|
||||||
private Action<bool, string>? _updateFunc;
|
private Func<bool, string, Task>? _updateFunc;
|
||||||
private readonly int _timeout = 30;
|
private readonly int _timeout = 30;
|
||||||
private static readonly string _tag = "UpdateService";
|
private static readonly string _tag = "UpdateService";
|
||||||
|
|
||||||
public async Task CheckUpdateGuiN(Config config, Action<bool, string> updateFunc, bool preRelease)
|
public async Task CheckUpdateGuiN(Config config, Func<bool, string, Task> updateFunc, bool preRelease)
|
||||||
{
|
{
|
||||||
_updateFunc = updateFunc;
|
_updateFunc = updateFunc;
|
||||||
var url = string.Empty;
|
var url = string.Empty;
|
||||||
|
|
@ -20,25 +20,25 @@ public class UpdateService
|
||||||
{
|
{
|
||||||
if (args.Success)
|
if (args.Success)
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(false, ResUI.MsgDownloadV2rayCoreSuccessfully);
|
UpdateFunc(false, ResUI.MsgDownloadV2rayCoreSuccessfully);
|
||||||
_updateFunc?.Invoke(true, Utils.UrlEncode(fileName));
|
UpdateFunc(true, Utils.UrlEncode(fileName));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(false, args.Msg);
|
UpdateFunc(false, args.Msg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
downloadHandle.Error += (sender2, args) =>
|
downloadHandle.Error += (sender2, args) =>
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(false, args.GetException().Message);
|
UpdateFunc(false, args.GetException().Message);
|
||||||
};
|
};
|
||||||
|
|
||||||
_updateFunc?.Invoke(false, string.Format(ResUI.MsgStartUpdating, ECoreType.v2rayN));
|
await UpdateFunc(false, string.Format(ResUI.MsgStartUpdating, ECoreType.v2rayN));
|
||||||
var result = await CheckUpdateAsync(downloadHandle, ECoreType.v2rayN, preRelease);
|
var result = await CheckUpdateAsync(downloadHandle, ECoreType.v2rayN, preRelease);
|
||||||
if (result.Success)
|
if (result.Success)
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(false, string.Format(ResUI.MsgParsingSuccessfully, ECoreType.v2rayN));
|
await UpdateFunc(false, string.Format(ResUI.MsgParsingSuccessfully, ECoreType.v2rayN));
|
||||||
_updateFunc?.Invoke(false, result.Msg);
|
await UpdateFunc(false, result.Msg);
|
||||||
|
|
||||||
url = result.Data?.ToString();
|
url = result.Data?.ToString();
|
||||||
fileName = Utils.GetTempPath(Utils.GetGuid());
|
fileName = Utils.GetTempPath(Utils.GetGuid());
|
||||||
|
|
@ -46,11 +46,11 @@ public class UpdateService
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(false, result.Msg);
|
await UpdateFunc(false, result.Msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task CheckUpdateCore(ECoreType type, Config config, Action<bool, string> updateFunc, bool preRelease)
|
public async Task CheckUpdateCore(ECoreType type, Config config, Func<bool, string, Task> updateFunc, bool preRelease)
|
||||||
{
|
{
|
||||||
_updateFunc = updateFunc;
|
_updateFunc = updateFunc;
|
||||||
var url = string.Empty;
|
var url = string.Empty;
|
||||||
|
|
@ -61,34 +61,34 @@ public class UpdateService
|
||||||
{
|
{
|
||||||
if (args.Success)
|
if (args.Success)
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(false, ResUI.MsgDownloadV2rayCoreSuccessfully);
|
UpdateFunc(false, ResUI.MsgDownloadV2rayCoreSuccessfully);
|
||||||
_updateFunc?.Invoke(false, ResUI.MsgUnpacking);
|
UpdateFunc(false, ResUI.MsgUnpacking);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(true, fileName);
|
UpdateFunc(true, fileName);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(false, ex.Message);
|
UpdateFunc(false, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(false, args.Msg);
|
UpdateFunc(false, args.Msg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
downloadHandle.Error += (sender2, args) =>
|
downloadHandle.Error += (sender2, args) =>
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(false, args.GetException().Message);
|
UpdateFunc(false, args.GetException().Message);
|
||||||
};
|
};
|
||||||
|
|
||||||
_updateFunc?.Invoke(false, string.Format(ResUI.MsgStartUpdating, type));
|
await UpdateFunc(false, string.Format(ResUI.MsgStartUpdating, type));
|
||||||
var result = await CheckUpdateAsync(downloadHandle, type, preRelease);
|
var result = await CheckUpdateAsync(downloadHandle, type, preRelease);
|
||||||
if (result.Success)
|
if (result.Success)
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(false, string.Format(ResUI.MsgParsingSuccessfully, type));
|
await UpdateFunc(false, string.Format(ResUI.MsgParsingSuccessfully, type));
|
||||||
_updateFunc?.Invoke(false, result.Msg);
|
await UpdateFunc(false, result.Msg);
|
||||||
|
|
||||||
url = result.Data?.ToString();
|
url = result.Data?.ToString();
|
||||||
var ext = url.Contains(".tar.gz") ? ".tar.gz" : Path.GetExtension(url);
|
var ext = url.Contains(".tar.gz") ? ".tar.gz" : Path.GetExtension(url);
|
||||||
|
|
@ -99,17 +99,17 @@ public class UpdateService
|
||||||
{
|
{
|
||||||
if (!result.Msg.IsNullOrEmpty())
|
if (!result.Msg.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(false, result.Msg);
|
await UpdateFunc(false, result.Msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateGeoFileAll(Config config, Action<bool, string> updateFunc)
|
public async Task UpdateGeoFileAll(Config config, Func<bool, string, Task> updateFunc)
|
||||||
{
|
{
|
||||||
await UpdateGeoFiles(config, updateFunc);
|
await UpdateGeoFiles(config, updateFunc);
|
||||||
await UpdateOtherFiles(config, updateFunc);
|
await UpdateOtherFiles(config, updateFunc);
|
||||||
await UpdateSrsFileAll(config, updateFunc);
|
await UpdateSrsFileAll(config, updateFunc);
|
||||||
_updateFunc?.Invoke(true, string.Format(ResUI.MsgDownloadGeoFileSuccessfully, "geo"));
|
await UpdateFunc(true, string.Format(ResUI.MsgDownloadGeoFileSuccessfully, "geo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#region CheckUpdate private
|
#region CheckUpdate private
|
||||||
|
|
@ -128,7 +128,7 @@ public class UpdateService
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.SaveLog(_tag, ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
_updateFunc?.Invoke(false, ex.Message);
|
await UpdateFunc(false, ex.Message);
|
||||||
return new RetResult(false, ex.Message);
|
return new RetResult(false, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -212,7 +212,7 @@ public class UpdateService
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.SaveLog(_tag, ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
_updateFunc?.Invoke(false, ex.Message);
|
await UpdateFunc(false, ex.Message);
|
||||||
return new SemanticVersion("");
|
return new SemanticVersion("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -272,7 +272,7 @@ public class UpdateService
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.SaveLog(_tag, ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
_updateFunc?.Invoke(false, ex.Message);
|
await UpdateFunc(false, ex.Message);
|
||||||
return new RetResult(false, ex.Message);
|
return new RetResult(false, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -333,7 +333,7 @@ public class UpdateService
|
||||||
|
|
||||||
#region Geo private
|
#region Geo private
|
||||||
|
|
||||||
private async Task UpdateGeoFiles(Config config, Action<bool, string> updateFunc)
|
private async Task UpdateGeoFiles(Config config, Func<bool, string, Task> updateFunc)
|
||||||
{
|
{
|
||||||
_updateFunc = updateFunc;
|
_updateFunc = updateFunc;
|
||||||
|
|
||||||
|
|
@ -352,7 +352,7 @@ public class UpdateService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateOtherFiles(Config config, Action<bool, string> updateFunc)
|
private async Task UpdateOtherFiles(Config config, Func<bool, string, Task> updateFunc)
|
||||||
{
|
{
|
||||||
//If it is not in China area, no update is required
|
//If it is not in China area, no update is required
|
||||||
if (config.ConstItem.GeoSourceUrl.IsNotEmpty())
|
if (config.ConstItem.GeoSourceUrl.IsNotEmpty())
|
||||||
|
|
@ -371,7 +371,7 @@ public class UpdateService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateSrsFileAll(Config config, Action<bool, string> updateFunc)
|
private async Task UpdateSrsFileAll(Config config, Func<bool, string, Task> updateFunc)
|
||||||
{
|
{
|
||||||
_updateFunc = updateFunc;
|
_updateFunc = updateFunc;
|
||||||
|
|
||||||
|
|
@ -426,7 +426,7 @@ public class UpdateService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateSrsFile(string type, string srsName, Config config, Action<bool, string> updateFunc)
|
private async Task UpdateSrsFile(string type, string srsName, Config config, Func<bool, string, Task> updateFunc)
|
||||||
{
|
{
|
||||||
var srsUrl = string.IsNullOrEmpty(config.ConstItem.SrsSourceUrl)
|
var srsUrl = string.IsNullOrEmpty(config.ConstItem.SrsSourceUrl)
|
||||||
? Global.SingboxRulesetUrl
|
? Global.SingboxRulesetUrl
|
||||||
|
|
@ -439,7 +439,7 @@ public class UpdateService
|
||||||
await DownloadGeoFile(url, fileName, targetPath, updateFunc);
|
await DownloadGeoFile(url, fileName, targetPath, updateFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DownloadGeoFile(string url, string fileName, string targetPath, Action<bool, string> updateFunc)
|
private async Task DownloadGeoFile(string url, string fileName, string targetPath, Func<bool, string, Task> updateFunc)
|
||||||
{
|
{
|
||||||
var tmpFileName = Utils.GetTempPath(Utils.GetGuid());
|
var tmpFileName = Utils.GetTempPath(Utils.GetGuid());
|
||||||
|
|
||||||
|
|
@ -448,7 +448,7 @@ public class UpdateService
|
||||||
{
|
{
|
||||||
if (args.Success)
|
if (args.Success)
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(false, string.Format(ResUI.MsgDownloadGeoFileSuccessfully, fileName));
|
UpdateFunc(false, string.Format(ResUI.MsgDownloadGeoFileSuccessfully, fileName));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -457,26 +457,31 @@ public class UpdateService
|
||||||
File.Copy(tmpFileName, targetPath, true);
|
File.Copy(tmpFileName, targetPath, true);
|
||||||
|
|
||||||
File.Delete(tmpFileName);
|
File.Delete(tmpFileName);
|
||||||
//_updateFunc?.Invoke(true, "");
|
//await UpdateFunc(true, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(false, ex.Message);
|
UpdateFunc(false, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(false, args.Msg);
|
UpdateFunc(false, args.Msg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
downloadHandle.Error += (sender2, args) =>
|
downloadHandle.Error += (sender2, args) =>
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(false, args.GetException().Message);
|
UpdateFunc(false, args.GetException().Message);
|
||||||
};
|
};
|
||||||
|
|
||||||
await downloadHandle.DownloadFileAsync(url, tmpFileName, true, _timeout);
|
await downloadHandle.DownloadFileAsync(url, tmpFileName, true, _timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Geo private
|
#endregion Geo private
|
||||||
|
|
||||||
|
private async Task UpdateFunc(bool notify, string msg)
|
||||||
|
{
|
||||||
|
await _updateFunc?.Invoke(notify, msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,9 +89,11 @@ public class CheckUpdateViewModel : MyReactiveObject
|
||||||
{
|
{
|
||||||
var item = _checkUpdateModel[k];
|
var item = _checkUpdateModel[k];
|
||||||
if (item.IsSelected != true)
|
if (item.IsSelected != true)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
UpdateView(item.CoreType, "...");
|
await UpdateView(item.CoreType, "...");
|
||||||
if (item.CoreType == _geo)
|
if (item.CoreType == _geo)
|
||||||
{
|
{
|
||||||
await CheckUpdateGeo();
|
await CheckUpdateGeo();
|
||||||
|
|
@ -129,9 +131,9 @@ public class CheckUpdateViewModel : MyReactiveObject
|
||||||
|
|
||||||
private async Task CheckUpdateGeo()
|
private async Task CheckUpdateGeo()
|
||||||
{
|
{
|
||||||
void _updateUI(bool success, string msg)
|
async Task _updateUI(bool success, string msg)
|
||||||
{
|
{
|
||||||
UpdateView(_geo, msg);
|
await UpdateView(_geo, msg);
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
UpdatedPlusPlus(_geo, "");
|
UpdatedPlusPlus(_geo, "");
|
||||||
|
|
@ -146,12 +148,12 @@ public class CheckUpdateViewModel : MyReactiveObject
|
||||||
|
|
||||||
private async Task CheckUpdateN(bool preRelease)
|
private async Task CheckUpdateN(bool preRelease)
|
||||||
{
|
{
|
||||||
void _updateUI(bool success, string msg)
|
async Task _updateUI(bool success, string msg)
|
||||||
{
|
{
|
||||||
UpdateView(_v2rayN, msg);
|
await UpdateView(_v2rayN, msg);
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
UpdateView(_v2rayN, ResUI.OperationSuccess);
|
await UpdateView(_v2rayN, ResUI.OperationSuccess);
|
||||||
UpdatedPlusPlus(_v2rayN, msg);
|
UpdatedPlusPlus(_v2rayN, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -164,12 +166,12 @@ public class CheckUpdateViewModel : MyReactiveObject
|
||||||
|
|
||||||
private async Task CheckUpdateCore(CheckUpdateModel model, bool preRelease)
|
private async Task CheckUpdateCore(CheckUpdateModel model, bool preRelease)
|
||||||
{
|
{
|
||||||
void _updateUI(bool success, string msg)
|
async Task _updateUI(bool success, string msg)
|
||||||
{
|
{
|
||||||
UpdateView(model.CoreType, msg);
|
await UpdateView(model.CoreType, msg);
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
UpdateView(model.CoreType, ResUI.MsgUpdateV2rayCoreSuccessfullyMore);
|
await UpdateView(model.CoreType, ResUI.MsgUpdateV2rayCoreSuccessfullyMore);
|
||||||
|
|
||||||
UpdatedPlusPlus(model.CoreType, msg);
|
UpdatedPlusPlus(model.CoreType, msg);
|
||||||
}
|
}
|
||||||
|
|
@ -193,7 +195,7 @@ public class CheckUpdateViewModel : MyReactiveObject
|
||||||
if (_lstUpdated.Any(x => x.CoreType == _v2rayN && x.IsFinished == true))
|
if (_lstUpdated.Any(x => x.CoreType == _v2rayN && x.IsFinished == true))
|
||||||
{
|
{
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
UpgradeN();
|
await UpgradeN();
|
||||||
}
|
}
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
_updateView?.Invoke(EViewAction.DispatcherCheckUpdateFinished, true);
|
_updateView?.Invoke(EViewAction.DispatcherCheckUpdateFinished, true);
|
||||||
|
|
@ -212,7 +214,7 @@ public class CheckUpdateViewModel : MyReactiveObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpgradeN()
|
private async Task UpgradeN()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -223,14 +225,14 @@ public class CheckUpdateViewModel : MyReactiveObject
|
||||||
}
|
}
|
||||||
if (!Utils.UpgradeAppExists(out _))
|
if (!Utils.UpgradeAppExists(out _))
|
||||||
{
|
{
|
||||||
UpdateView(_v2rayN, ResUI.UpgradeAppNotExistTip);
|
await UpdateView(_v2rayN, ResUI.UpgradeAppNotExistTip);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Locator.Current.GetService<MainWindowViewModel>()?.UpgradeApp(fileName);
|
Locator.Current.GetService<MainWindowViewModel>()?.UpgradeApp(fileName);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
UpdateView(_v2rayN, ex.Message);
|
await UpdateView(_v2rayN, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -281,7 +283,7 @@ public class CheckUpdateViewModel : MyReactiveObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateView(item.CoreType, ResUI.MsgUpdateV2rayCoreSuccessfully);
|
await UpdateView(item.CoreType, ResUI.MsgUpdateV2rayCoreSuccessfully);
|
||||||
|
|
||||||
if (File.Exists(fileName))
|
if (File.Exists(fileName))
|
||||||
{
|
{
|
||||||
|
|
@ -290,21 +292,24 @@ public class CheckUpdateViewModel : MyReactiveObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateView(string coreType, string msg)
|
private async Task UpdateView(string coreType, string msg)
|
||||||
{
|
{
|
||||||
var item = new CheckUpdateModel()
|
var item = new CheckUpdateModel()
|
||||||
{
|
{
|
||||||
CoreType = coreType,
|
CoreType = coreType,
|
||||||
Remarks = msg,
|
Remarks = msg,
|
||||||
};
|
};
|
||||||
_updateView?.Invoke(EViewAction.DispatcherCheckUpdate, item);
|
await _updateView?.Invoke(EViewAction.DispatcherCheckUpdate, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateViewResult(CheckUpdateModel model)
|
public void UpdateViewResult(CheckUpdateModel model)
|
||||||
{
|
{
|
||||||
var found = _checkUpdateModel.FirstOrDefault(t => t.CoreType == model.CoreType);
|
var found = _checkUpdateModel.FirstOrDefault(t => t.CoreType == model.CoreType);
|
||||||
if (found == null)
|
if (found == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var itemCopy = JsonUtils.DeepCopy(found);
|
var itemCopy = JsonUtils.DeepCopy(found);
|
||||||
itemCopy.Remarks = model.Remarks;
|
itemCopy.Remarks = model.Remarks;
|
||||||
_checkUpdateModel.Replace(found, itemCopy);
|
_checkUpdateModel.Replace(found, itemCopy);
|
||||||
|
|
|
||||||
|
|
@ -373,14 +373,14 @@ public class ClashProxiesViewModel : MyReactiveObject
|
||||||
|
|
||||||
private async Task ProxiesDelayTest(bool blAll = true)
|
private async Task ProxiesDelayTest(bool blAll = true)
|
||||||
{
|
{
|
||||||
ClashApiManager.Instance.ClashProxiesDelayTest(blAll, _proxyDetails.ToList(), (item, result) =>
|
ClashApiManager.Instance.ClashProxiesDelayTest(blAll, _proxyDetails.ToList(), async (item, result) =>
|
||||||
{
|
{
|
||||||
if (item == null || result.IsNullOrEmpty())
|
if (item == null || result.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateView?.Invoke(EViewAction.DispatcherProxiesDelayTest, new SpeedTestResult() { IndexId = item.Name, Delay = result });
|
await _updateView?.Invoke(EViewAction.DispatcherProxiesDelayTest, new SpeedTestResult() { IndexId = item.Name, Delay = result });
|
||||||
});
|
});
|
||||||
await Task.CompletedTask;
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ public class MainWindowViewModel : MyReactiveObject
|
||||||
|
|
||||||
#region Actions
|
#region Actions
|
||||||
|
|
||||||
private void UpdateHandler(bool notify, string msg)
|
private async Task UpdateHandler(bool notify, string msg)
|
||||||
{
|
{
|
||||||
NoticeManager.Instance.SendMessage(msg);
|
NoticeManager.Instance.SendMessage(msg);
|
||||||
if (notify)
|
if (notify)
|
||||||
|
|
@ -254,7 +254,7 @@ public class MainWindowViewModel : MyReactiveObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateTaskHandler(bool success, string msg)
|
private async Task UpdateTaskHandler(bool success, string msg)
|
||||||
{
|
{
|
||||||
NoticeManager.Instance.SendMessageEx(msg);
|
NoticeManager.Instance.SendMessageEx(msg);
|
||||||
if (success)
|
if (success)
|
||||||
|
|
@ -263,7 +263,7 @@ public class MainWindowViewModel : MyReactiveObject
|
||||||
RefreshServers();
|
RefreshServers();
|
||||||
if (indexIdOld != _config.IndexId)
|
if (indexIdOld != _config.IndexId)
|
||||||
{
|
{
|
||||||
_ = Reload();
|
await Reload();
|
||||||
}
|
}
|
||||||
if (_config.UiItem.EnableAutoAdjustMainLvColWidth)
|
if (_config.UiItem.EnableAutoAdjustMainLvColWidth)
|
||||||
{
|
{
|
||||||
|
|
@ -272,13 +272,13 @@ public class MainWindowViewModel : MyReactiveObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateStatisticsHandler(ServerSpeedItem update)
|
private async Task UpdateStatisticsHandler(ServerSpeedItem update)
|
||||||
{
|
{
|
||||||
if (!_config.UiItem.ShowInTaskbar)
|
if (!_config.UiItem.ShowInTaskbar)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_updateView?.Invoke(EViewAction.DispatcherStatistics, update);
|
await _updateView?.Invoke(EViewAction.DispatcherStatistics, update);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetStatisticsResult(ServerSpeedItem update)
|
public void SetStatisticsResult(ServerSpeedItem update)
|
||||||
|
|
@ -596,7 +596,9 @@ public class MainWindowViewModel : MyReactiveObject
|
||||||
Locator.Current.GetService<ClashProxiesViewModel>()?.ProxiesReload();
|
Locator.Current.GetService<ClashProxiesViewModel>()?.ProxiesReload();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ TabMainSelectedIndex = 0; }
|
{
|
||||||
|
TabMainSelectedIndex = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task LoadCore()
|
private async Task LoadCore()
|
||||||
|
|
@ -631,7 +633,7 @@ public class MainWindowViewModel : MyReactiveObject
|
||||||
Locator.Current.GetService<StatusBarViewModel>()?.RefreshRoutingsMenu();
|
Locator.Current.GetService<StatusBarViewModel>()?.RefreshRoutingsMenu();
|
||||||
|
|
||||||
await ConfigHandler.SaveConfig(_config);
|
await ConfigHandler.SaveConfig(_config);
|
||||||
await new UpdateService().UpdateGeoFileAll(_config, UpdateHandler);
|
await new UpdateService().UpdateGeoFileAll(_config, UpdateTaskHandler);
|
||||||
await Reload();
|
await Reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue