Code clean

This commit is contained in:
2dust 2025-02-09 20:17:56 +08:00
parent c3fdfcc4bd
commit 31a179e647
3 changed files with 51 additions and 51 deletions

View file

@ -1,4 +1,4 @@
using static ServiceLib.Models.ClashProxies;
using static ServiceLib.Models.ClashProxies;
namespace ServiceLib.Handler
{
@ -41,7 +41,7 @@ namespace ServiceLib.Handler
{
if (blAll)
{
for (int i = 0; i < 5; i++)
for (var i = 0; i < 5; i++)
{
if (_proxies != null)
{
@ -75,7 +75,7 @@ namespace ServiceLib.Handler
var urlBase = $"{GetApiUrl()}/proxies";
urlBase += @"/{0}/delay?timeout=10000&url=" + AppHandler.Instance.Config.SpeedTestItem.SpeedPingTestUrl;
List<Task> tasks = new List<Task>();
var tasks = new List<Task>();
foreach (var it in lstProxy)
{
if (Global.notAllowTestType.Contains(it.Type.ToLower()))
@ -120,7 +120,7 @@ namespace ServiceLib.Handler
try
{
var url = $"{GetApiUrl()}/proxies/{name}";
Dictionary<string, string> headers = new Dictionary<string, string>();
var headers = new Dictionary<string, string>();
headers.Add("name", nameNode);
await HttpClientHelper.Instance.PutAsync(url, headers);
}
@ -148,7 +148,7 @@ namespace ServiceLib.Handler
try
{
var url = $"{GetApiUrl()}/configs?force=true";
Dictionary<string, string> headers = new Dictionary<string, string>();
var headers = new Dictionary<string, string>();
headers.Add("path", filePath);
await HttpClientHelper.Instance.PutAsync(url, headers);
}

View file

@ -21,7 +21,7 @@ namespace ServiceLib.Services.Statistics
Task.Run(Run);
}
private async void Init()
private async Task Init()
{
await Task.Delay(5000);
@ -53,9 +53,9 @@ namespace ServiceLib.Services.Statistics
}
}
private async void Run()
private async Task Run()
{
Init();
await Init();
while (!_exitFlag)
{
@ -73,7 +73,7 @@ namespace ServiceLib.Services.Statistics
{
webSocket.Abort();
webSocket = null;
Init();
await Init();
continue;
}

View file

@ -23,7 +23,7 @@ namespace ServiceLib.Services.Statistics
_exitFlag = true;
}
private async void Run()
private async Task Run()
{
while (!_exitFlag)
{