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);
}
await Task.Delay(5000);
await Task.Delay(2000);
}
return null;

View File

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

View File

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