From ebf5933416044fe7bfbe407b4acd30d2a1539f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=B1=B3?= Date: Sat, 6 Jul 2024 21:34:44 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=AE=9Affmpeg=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E4=BB=8ER2=E8=B5=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/Tools/ProgramUpdates.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Core/Tools/ProgramUpdates.cs b/Core/Tools/ProgramUpdates.cs index f96f6f6b0..fdb91511c 100644 --- a/Core/Tools/ProgramUpdates.cs +++ b/Core/Tools/ProgramUpdates.cs @@ -328,7 +328,7 @@ private static void ReplaceUpdateFfmpe(string url) { string ffmpegPath = "./plugins/ffmpeg/ffmpeg.exe"; string ffmpegUpdatePath = Core.Config.Core_RunConfig._TemporaryFileDirectory + "update_ffmpeg.exe"; - if (DownloadFileAsync(url, ffmpegUpdatePath)) + if (DownloadFileAsync(url, ffmpegUpdatePath,true)) { if (File.Exists(ffmpegUpdatePath)) { @@ -340,6 +340,10 @@ private static void ReplaceUpdateFfmpe(string url) Log.Info(nameof(ReplaceUpdateFfmpe), "检查并更新ffmpeg依赖完成"); } } + else + { + Log.Warn(nameof(ReplaceUpdateFfmpe), "尝试检查并更新ffmpeg依赖时,无法连接R2服务器,更新失败"); + } } catch (Exception ex) { @@ -475,7 +479,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, bool restrictedPrimaryServer = false) { int error_count = 0; while (true) @@ -492,6 +496,11 @@ public static bool DownloadFileAsync(string url, string outputPath) } else { + if(restrictedPrimaryServer) + { + Log.Info(nameof(Update_UpdateProgram),$"出现网络错误,MainOnly"); + return false; + } FileDownloadAddress = MainDomainName + url; } try