From e8a7be6957bdec5ef51a8cbdae9ee234863db38a Mon Sep 17 00:00:00 2001 From: hevinci Date: Thu, 24 Mar 2022 21:34:18 +0800 Subject: [PATCH] Update AssetSystem --- .../Handles/SubAssetsOperationHandle.cs | 2 +- .../AssetSystem/Operations/RawFileOperation.cs | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Assets/YooAsset/Runtime/AssetSystem/Handles/SubAssetsOperationHandle.cs b/Assets/YooAsset/Runtime/AssetSystem/Handles/SubAssetsOperationHandle.cs index f71f28d..2d3486c 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Handles/SubAssetsOperationHandle.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Handles/SubAssetsOperationHandle.cs @@ -86,7 +86,7 @@ namespace YooAsset return asset as TObject; } - YooLogger.Warning($"Not found sub asset {assetName} in {_provider.AssetPath}"); + YooLogger.Warning($"Not found sub asset object : {assetName}"); return null; } } diff --git a/Assets/YooAsset/Runtime/AssetSystem/Operations/RawFileOperation.cs b/Assets/YooAsset/Runtime/AssetSystem/Operations/RawFileOperation.cs index 6ecec2d..29b7369 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Operations/RawFileOperation.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Operations/RawFileOperation.cs @@ -95,12 +95,20 @@ namespace YooAsset // 4. 检测文件 if (_steps == ESteps.CheckFile) { - // 注意:本地已经存在的文件不保证完整性 + // 注意:如果原生文件已经存在,则验证其完整性 if (File.Exists(_savePath)) { - _steps = ESteps.Done; - Status = EOperationStatus.Succeed; - return; + bool result = DownloadSystem.CheckContentIntegrity(_savePath, _bundleInfo.SizeBytes, _bundleInfo.CRC); + if (result) + { + _steps = ESteps.Done; + Status = EOperationStatus.Succeed; + return; + } + else + { + File.Delete(_savePath); + } } if (_bundleInfo.IsBuildinJarFile()) @@ -166,7 +174,7 @@ namespace YooAsset return null; return File.ReadAllBytes(_savePath); } - + /// /// 获取原生文件的文本数据 ///