Update CacheSystem

修复原生文件每次获取都重复拷贝的问题
This commit is contained in:
hevinci
2022-10-18 10:19:17 +08:00
parent 9e2efe3717
commit c449a070b4
9 changed files with 349 additions and 282 deletions

View File

@@ -288,6 +288,38 @@ namespace YooAsset
return bundleInfo;
}
internal List<VerifyInfo> GetVerifyInfoList(bool weaklyUpdateMode)
{
List<VerifyInfo> result = new List<VerifyInfo>(LocalPatchManifest.BundleList.Count);
// 遍历所有文件然后验证并缓存合法文件
foreach (var patchBundle in LocalPatchManifest.BundleList)
{
// 忽略缓存文件
if (CacheSystem.IsCached(patchBundle))
continue;
// 注意:在弱联网模式下,我们需要验证指定资源版本的所有资源完整性
if (weaklyUpdateMode)
{
bool isBuildinFile = IsBuildinPatchBundle(patchBundle);
VerifyInfo verifyInfo = new VerifyInfo(isBuildinFile, patchBundle);
result.Add(verifyInfo);
}
else
{
string filePath = patchBundle.CachedFilePath;
if (File.Exists(filePath))
{
bool isBuildinFile = IsBuildinPatchBundle(patchBundle);
VerifyInfo verifyInfo = new VerifyInfo(isBuildinFile, patchBundle);
result.Add(verifyInfo);
}
}
}
return result;
}
internal void SetLocalPatchManifest(PatchManifest patchManifest)
{
LocalPatchManifest = patchManifest;