update cache system

缓存系统支持后缀名存储方式
This commit is contained in:
hevinci
2023-02-22 16:46:36 +08:00
parent 8958317f61
commit d1f2712e5f
5 changed files with 38 additions and 16 deletions
@@ -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);
@@ -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();
}
}
}