diff --git a/Update/Program.cs b/Update/Program.cs index 0e6e016ba..6d7581c6b 100644 --- a/Update/Program.cs +++ b/Update/Program.cs @@ -100,9 +100,11 @@ public static void Main(string[] args) Directory.CreateDirectory(directoryPath); } bool dl_ok = false; + int time = 10; do { dl_ok = DownloadFileAsync(item.Key, item.Value.FilePath); + time += 20; } while (!dl_ok); Console.WriteLine($" | 更新文件【{item.Value.Name}】成功"); i++; @@ -259,7 +261,7 @@ public static string Get(string URL) return str; } - public static bool DownloadFileAsync(string url, string outputPath) + public static bool DownloadFileAsync(string url, string outputPath,long Time = 10) { int error_count = 0; while (true) @@ -281,7 +283,7 @@ public static bool DownloadFileAsync(string url, string outputPath) try { HttpClient _httpClient = new HttpClient(); - _httpClient.Timeout = new TimeSpan(0, 0, 10); + _httpClient.Timeout = new TimeSpan(0, 0, 10).Add(TimeSpan.FromSeconds(Time)); _httpClient.DefaultRequestHeaders.Referrer = new Uri("https://update5.ddtv.pro"); using var response = _httpClient.GetAsync(FileDownloadAddress, HttpCompletionOption.ResponseHeadersRead).Result; response.EnsureSuccessStatusCode();