2dust 2024-10-26 09:55:22 +08:00
parent 1106fd8cf1
commit 6e35a260e8
3 changed files with 29 additions and 31 deletions

View File

@ -28,7 +28,7 @@ namespace ServiceLib.Handler
return new Tuple<ClashProxies, ClashProviders>(clashProxies, clashProviders); return new Tuple<ClashProxies, ClashProviders>(clashProxies, clashProviders);
} }
await Task.Delay(5000); await Task.Delay(2000);
} }
return null; return null;

View File

@ -12,18 +12,12 @@
if (node.ConfigType == EConfigType.Custom) if (node.ConfigType == EConfigType.Custom)
{ {
if (node.CoreType is ECoreType.mihomo) result = node.CoreType switch
{ {
result = await new CoreConfigClashService(config).GenerateClientCustomConfig(node, fileName); ECoreType.mihomo => await new CoreConfigClashService(config).GenerateClientCustomConfig(node, fileName),
} ECoreType.sing_box => await new CoreConfigSingboxService(config).GenerateClientCustomConfig(node, fileName),
if (node.CoreType is ECoreType.sing_box) _ => await GenerateClientCustomConfig(node, fileName)
{ };
result = await new CoreConfigSingboxService(config).GenerateClientCustomConfig(node, fileName);
}
else
{
result = await GenerateClientCustomConfig(node, fileName);
}
} }
else if (AppHandler.Instance.GetCoreType(node, node.ConfigType) == ECoreType.sing_box) else if (AppHandler.Instance.GetCoreType(node, node.ConfigType) == ECoreType.sing_box)
{ {

View File

@ -96,7 +96,7 @@ namespace ServiceLib.ViewModels
private async Task Init() private async Task Init()
{ {
await ProxiesReload(); await ProxiesReload();
await DelayTestTask(); DelayTestTask();
} }
private async Task DoRulemodeSelected(bool c) private async Task DoRulemodeSelected(bool c)
@ -434,24 +434,28 @@ namespace ServiceLib.ViewModels
public async Task DelayTestTask() public async Task DelayTestTask()
{ {
var lastTime = DateTime.Now; var lastTime = DateTime.Now;
Task.Run(async () =>
Observable.Interval(TimeSpan.FromSeconds(60))
.Subscribe(async x =>
{ {
while (true)
{
await Task.Delay(1000 * 60);
if (!(AutoRefresh && _config.UiItem.ShowInTaskbar && _config.IsRunningCore(ECoreType.sing_box))) if (!(AutoRefresh && _config.UiItem.ShowInTaskbar && _config.IsRunningCore(ECoreType.sing_box)))
{ {
return; continue;
}
if (_config.ClashUIItem.ProxiesAutoDelayTestInterval <= 0)
{
continue;
} }
var dtNow = DateTime.Now; var dtNow = DateTime.Now;
if (_config.ClashUIItem.ProxiesAutoDelayTestInterval > 0) if ((dtNow - lastTime).Minutes % _config.ClashUIItem.ProxiesAutoDelayTestInterval != 0)
{
if ((dtNow - lastTime).Minutes % _config.ClashUIItem.ProxiesAutoDelayTestInterval == 0)
{ {
continue;
}
await ProxiesDelayTest(); await ProxiesDelayTest();
lastTime = dtNow; lastTime = dtNow;
} }
Task.Delay(1000).Wait();
}
}); });
} }