diff --git a/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystem.cs b/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystem.cs index 3c8eb705..c77c9921 100644 --- a/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystem.cs +++ b/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystem.cs @@ -155,17 +155,24 @@ namespace YooAsset } public static bool CheckContentIntegrity(string filePath, long size, string crc) { - if (File.Exists(filePath) == false) - return false; + try + { + if (File.Exists(filePath) == false) + return false; - // 先验证文件大小 - long fileSize = FileUtility.GetFileSize(filePath); - if (fileSize != size) - return false; + // 先验证文件大小 + long fileSize = FileUtility.GetFileSize(filePath); + if (fileSize != size) + return false; - // 再验证文件CRC - string fileCRC = HashUtility.FileCRC32(filePath); - return fileCRC == crc; + // 再验证文件CRC + string fileCRC = HashUtility.FileCRC32(filePath); + return fileCRC == crc; + } + catch(Exception) + { + return false; + } } } } \ No newline at end of file diff --git a/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdateManifestOperation.cs b/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdateManifestOperation.cs index 6367c591..a019e466 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdateManifestOperation.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdateManifestOperation.cs @@ -332,16 +332,8 @@ namespace YooAsset } private void VerifyInThread(object infoObj) { - // 验证沙盒内的文件 ThreadInfo info = (ThreadInfo)infoObj; - try - { - info.Result = DownloadSystem.CheckContentIntegrity(info.FilePath, info.Bundle.SizeBytes, info.Bundle.CRC); - } - catch (Exception) - { - info.Result = false; - } + info.Result = DownloadSystem.CheckContentIntegrity(info.FilePath, info.Bundle.SizeBytes, info.Bundle.CRC); _syncContext.Post(VerifyCallback, info); } private void VerifyCallback(object obj)