diff --git a/Assets/YooAsset/Runtime/CacheSystem/CacheSystem.cs b/Assets/YooAsset/Runtime/CacheSystem/CacheSystem.cs
index 3ff00d2..3f17277 100644
--- a/Assets/YooAsset/Runtime/CacheSystem/CacheSystem.cs
+++ b/Assets/YooAsset/Runtime/CacheSystem/CacheSystem.cs
@@ -13,7 +13,7 @@ namespace YooAsset
///
/// 初始化时的验证级别
///
- public static EVerifyLevel InitVerifyLevel { set; get; } = EVerifyLevel.Low;
+ public static EVerifyLevel InitVerifyLevel { set; get; } = EVerifyLevel.Middle;
///
/// 清空所有数据
@@ -37,6 +37,7 @@ namespace YooAsset
///
public static void RecordFile(string packageName, string cacheGUID, PackageCache.RecordWrapper wrapper)
{
+ //YooLogger.Log($"Record file : {packageName} = {cacheGUID}");
var cache = GetOrCreateCache(packageName);
cache.Record(cacheGUID, wrapper);
}
diff --git a/Assets/YooAsset/Runtime/CacheSystem/Operations/PackageCachingOperation.cs b/Assets/YooAsset/Runtime/CacheSystem/Operations/PackageCachingOperation.cs
index 844ed5e..aafa1af 100644
--- a/Assets/YooAsset/Runtime/CacheSystem/Operations/PackageCachingOperation.cs
+++ b/Assets/YooAsset/Runtime/CacheSystem/Operations/PackageCachingOperation.cs
@@ -67,8 +67,23 @@ namespace YooAsset
if (CacheSystem.IsCached(_packageName, cacheGUID))
continue;
+ // 获取数据文件的后缀名
+ string dataFileExtension = string.Empty;
+ var fileInfos = fileFoder.GetFiles();
+ foreach (var fileInfo in fileInfos)
+ {
+ if (fileInfo.Extension == ".temp")
+ continue;
+
+ if (fileInfo.Name.StartsWith(YooAssetSettings.CacheBundleDataFileName))
+ {
+ dataFileExtension = fileInfo.Extension;
+ break;
+ }
+ }
+
string fileRootPath = fileFoder.FullName;
- string dataFilePath = $"{fileRootPath}/{ YooAssetSettings.CacheBundleDataFileName}";
+ string dataFilePath = $"{fileRootPath}/{ YooAssetSettings.CacheBundleDataFileName}{dataFileExtension}";
string infoFilePath = $"{fileRootPath}/{ YooAssetSettings.CacheBundleInfoFileName}";
VerifyElement element = new VerifyElement(_packageName, cacheGUID, fileRootPath, dataFilePath, infoFilePath);
result.Add(element);
diff --git a/Assets/YooAsset/Runtime/CacheSystem/Operations/PackageVerifyOperation.cs b/Assets/YooAsset/Runtime/CacheSystem/Operations/PackageVerifyOperation.cs
index 2ea948f..db2a563 100644
--- a/Assets/YooAsset/Runtime/CacheSystem/Operations/PackageVerifyOperation.cs
+++ b/Assets/YooAsset/Runtime/CacheSystem/Operations/PackageVerifyOperation.cs
@@ -139,12 +139,8 @@ namespace YooAsset
{
_failedCount++;
- // 删除验证失败的缓存文件
- if (Directory.Exists(element.FileRootPath))
- {
- YooLogger.Warning($"Failed verify file and delete files : {element.FileRootPath}");
- Directory.Delete(element.FileRootPath, true);
- }
+ YooLogger.Warning($"Failed verify file and delete files : {element.FileRootPath}");
+ element.DeleteFiles();
}
}
}
@@ -246,12 +242,8 @@ namespace YooAsset
{
_failedCount++;
- // 删除验证失败的缓存文件
- if (Directory.Exists(element.FileRootPath))
- {
- YooLogger.Warning($"Failed verify file and delete files : {element.FileRootPath}");
- Directory.Delete(element.FileRootPath, true);
- }
+ YooLogger.Warning($"Failed verify file and delete files : {element.FileRootPath}");
+ element.DeleteFiles();
}
}
}
diff --git a/Assets/YooAsset/Runtime/CacheSystem/VerifyElement.cs b/Assets/YooAsset/Runtime/CacheSystem/VerifyElement.cs
index 493cec1..f59ca7a 100644
--- a/Assets/YooAsset/Runtime/CacheSystem/VerifyElement.cs
+++ b/Assets/YooAsset/Runtime/CacheSystem/VerifyElement.cs
@@ -1,4 +1,5 @@
-
+using System.IO;
+
namespace YooAsset
{
internal class VerifyElement
@@ -21,5 +22,18 @@ namespace YooAsset
DataFilePath = dataFilePath;
InfoFilePath = infoFilePath;
}
+
+ public void DeleteFiles()
+ {
+ if (File.Exists(DataFilePath))
+ {
+ File.Delete(DataFilePath);
+ }
+
+ if (File.Exists(InfoFilePath))
+ {
+ File.Delete(InfoFilePath);
+ }
+ }
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/PatchSystem/PatchBundle.cs b/Assets/YooAsset/Runtime/PatchSystem/PatchBundle.cs
index 0d6a405..d4a7699 100644
--- a/Assets/YooAsset/Runtime/PatchSystem/PatchBundle.cs
+++ b/Assets/YooAsset/Runtime/PatchSystem/PatchBundle.cs
@@ -72,7 +72,7 @@ namespace YooAsset
return _cachedDataFilePath;
string cacheRoot = PersistentHelper.GetCacheFolderPath(PackageName);
- _cachedDataFilePath = $"{cacheRoot}/{CacheGUID}/{YooAssetSettings.CacheBundleDataFileName}";
+ _cachedDataFilePath = $"{cacheRoot}/{CacheGUID}/{YooAssetSettings.CacheBundleDataFileName}{_fileExtension}";
return _cachedDataFilePath;
}
}