From 084d4ab363a25a7c29b05e267ca9ec0525ed4a56 Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Tue, 15 Mar 2022 19:43:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DownKyi/Services/Download/AriaDownloadService.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/DownKyi/Services/Download/AriaDownloadService.cs b/DownKyi/Services/Download/AriaDownloadService.cs index a972b7e..b8c566e 100644 --- a/DownKyi/Services/Download/AriaDownloadService.cs +++ b/DownKyi/Services/Download/AriaDownloadService.cs @@ -142,20 +142,26 @@ namespace DownKyi.Services.Download // 下载文件名 string fileName = Guid.NewGuid().ToString("N"); - string key = $"{downloadVideo.Id}_{downloadVideo.Codecs}"; + // 老版本数据库没有这一项,会变成null if (downloading.Downloading.DownloadedFiles == null) + { downloading.Downloading.DownloadedFiles = new List(); + } + if (downloading.Downloading.DownloadFiles.ContainsKey(key)) { // 如果存在,表示下载过, // 则继续使用上次下载的文件名 fileName = downloading.Downloading.DownloadFiles[key]; + // 还要检查一下文件有没有被人删掉,删掉的话重新下载 // 如果下载视频之后音频文件被人删了。此时gid还是视频的,会下错文件 if (downloading.Downloading.DownloadedFiles.Contains(key) && File.Exists(Path.Combine(path, fileName))) + { return Path.Combine(path, fileName); + } } else {