mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-14 19:40:47 +00:00
Update CacheSystem
This commit is contained in:
@@ -203,7 +203,7 @@ namespace YooAsset
|
||||
}
|
||||
else if (_bundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromStreaming)
|
||||
{
|
||||
if (CacheSystem.ContainsVerifyFile(_bundleInfo.FileHash))
|
||||
if (CacheSystem.ContainsVerifyFile(_bundleInfo.LoadBundle))
|
||||
_steps = ESteps.CheckAndCopyFile;
|
||||
else
|
||||
_steps = ESteps.DownloadFromApk;
|
||||
@@ -240,7 +240,7 @@ namespace YooAsset
|
||||
{
|
||||
if (CacheSystem.CheckContentIntegrity(GetCachePath(), _bundleInfo.FileSize, _bundleInfo.FileCRC))
|
||||
{
|
||||
CacheSystem.CacheVerifyFile(_bundleInfo.FileHash, _bundleInfo.FileName);
|
||||
CacheSystem.CacheVerifyFile(_bundleInfo.LoadBundle);
|
||||
_steps = ESteps.CheckAndCopyFile;
|
||||
}
|
||||
else
|
||||
@@ -355,7 +355,7 @@ namespace YooAsset
|
||||
}
|
||||
else if (_bundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromStreaming)
|
||||
{
|
||||
if (CacheSystem.ContainsVerifyFile(_bundleInfo.FileHash))
|
||||
if (CacheSystem.ContainsVerifyFile(_bundleInfo.LoadBundle))
|
||||
_steps = ESteps.CheckAndCopyFile;
|
||||
else
|
||||
_steps = ESteps.DownloadFromApk;
|
||||
@@ -423,7 +423,7 @@ namespace YooAsset
|
||||
{
|
||||
if (CacheSystem.CheckContentIntegrity(GetCachePath(), _bundleInfo.FileSize, _bundleInfo.FileCRC))
|
||||
{
|
||||
CacheSystem.CacheVerifyFile(_bundleInfo.FileHash, _bundleInfo.FileName);
|
||||
CacheSystem.CacheVerifyFile(_bundleInfo.LoadBundle);
|
||||
_steps = ESteps.CheckAndCopyFile;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace YooAsset
|
||||
{
|
||||
_verifyLevel = verifyLevel;
|
||||
}
|
||||
|
||||
public static void DestroyAll()
|
||||
{
|
||||
_cacheBundles.Clear();
|
||||
@@ -49,14 +48,13 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询是否为验证文件
|
||||
/// 注意:被收录的文件完整性是绝对有效的
|
||||
/// </summary>
|
||||
public static bool ContainsVerifyFile(string fileHash)
|
||||
public static bool ContainsVerifyFile(PatchBundle patchBundle)
|
||||
{
|
||||
string fileHash = patchBundle.FileHash;
|
||||
if (_cachedHashList.ContainsKey(fileHash))
|
||||
{
|
||||
string fileName = _cachedHashList[fileHash];
|
||||
@@ -81,8 +79,10 @@ namespace YooAsset
|
||||
/// <summary>
|
||||
/// 缓存验证过的文件
|
||||
/// </summary>
|
||||
public static void CacheVerifyFile(string fileHash, string fileName)
|
||||
public static void CacheVerifyFile(PatchBundle patchBundle)
|
||||
{
|
||||
string fileHash = patchBundle.FileHash;
|
||||
string fileName = patchBundle.FileName;
|
||||
if (_cachedHashList.ContainsKey(fileHash) == false)
|
||||
{
|
||||
YooLogger.Log($"Cache verify file : {fileName}");
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace YooAsset
|
||||
foreach (var patchBundle in localPatchManifest.BundleList)
|
||||
{
|
||||
// 忽略缓存文件
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle.FileHash))
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle))
|
||||
continue;
|
||||
|
||||
// 忽略APP资源
|
||||
@@ -140,7 +140,7 @@ namespace YooAsset
|
||||
if (info.Result)
|
||||
{
|
||||
VerifySuccessCount++;
|
||||
CacheSystem.CacheVerifyFile(info.Bundle.FileHash, info.Bundle.FileName);
|
||||
CacheSystem.CacheVerifyFile(info.Bundle);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -173,7 +173,7 @@ namespace YooAsset
|
||||
foreach (var patchBundle in localPatchManifest.BundleList)
|
||||
{
|
||||
// 忽略缓存文件
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle.FileHash))
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle))
|
||||
continue;
|
||||
|
||||
// 忽略APP资源
|
||||
@@ -239,7 +239,7 @@ namespace YooAsset
|
||||
if (result)
|
||||
{
|
||||
VerifySuccessCount++;
|
||||
CacheSystem.CacheVerifyFile(patchBundle.FileHash, patchBundle.FileName);
|
||||
CacheSystem.CacheVerifyFile(patchBundle);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
// 如果资源已经缓存
|
||||
if (CacheSystem.ContainsVerifyFile(bundleInfo.FileHash))
|
||||
if (CacheSystem.ContainsVerifyFile(bundleInfo.LoadBundle))
|
||||
{
|
||||
var tempDownloader = new TempDownloader(bundleInfo);
|
||||
return tempDownloader;
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace YooAsset
|
||||
if (hasError == false)
|
||||
{
|
||||
_steps = ESteps.Succeed;
|
||||
CacheSystem.CacheVerifyFile(_bundleInfo.FileHash, _bundleInfo.FileName);
|
||||
CacheSystem.CacheVerifyFile(_bundleInfo.LoadBundle);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -226,7 +226,7 @@ namespace YooAsset
|
||||
}
|
||||
else
|
||||
{
|
||||
CacheSystem.CacheVerifyFile(_bundleInfo.FileHash, _bundleInfo.FileName);
|
||||
CacheSystem.CacheVerifyFile(_bundleInfo.LoadBundle);
|
||||
_steps = ESteps.Succeed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace YooAsset
|
||||
foreach (var patchBundle in _remotePatchManifest.BundleList)
|
||||
{
|
||||
// 忽略缓存文件
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle.FileHash))
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle))
|
||||
continue;
|
||||
|
||||
// 忽略APP资源
|
||||
|
||||
@@ -131,7 +131,7 @@ namespace YooAsset
|
||||
foreach (var patchBundle in LocalPatchManifest.BundleList)
|
||||
{
|
||||
// 忽略缓存文件
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle.FileHash))
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle))
|
||||
continue;
|
||||
|
||||
// 忽略APP资源
|
||||
@@ -163,7 +163,7 @@ namespace YooAsset
|
||||
foreach (var patchBundle in LocalPatchManifest.BundleList)
|
||||
{
|
||||
// 忽略缓存文件
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle.FileHash))
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle))
|
||||
continue;
|
||||
|
||||
// 忽略APP资源
|
||||
@@ -233,7 +233,7 @@ namespace YooAsset
|
||||
foreach (var patchBundle in checkList)
|
||||
{
|
||||
// 忽略缓存文件
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle.FileHash))
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle))
|
||||
continue;
|
||||
|
||||
// 忽略APP资源
|
||||
@@ -269,7 +269,7 @@ namespace YooAsset
|
||||
continue;
|
||||
|
||||
// 忽略缓存文件
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle.FileHash))
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle))
|
||||
continue;
|
||||
|
||||
// 查询DLC资源
|
||||
@@ -301,7 +301,7 @@ namespace YooAsset
|
||||
continue;
|
||||
|
||||
// 忽略缓存文件
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle.FileHash))
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle))
|
||||
continue;
|
||||
|
||||
downloadList.Add(patchBundle);
|
||||
@@ -377,7 +377,7 @@ namespace YooAsset
|
||||
throw new Exception("Should never get here !");
|
||||
|
||||
// 查询沙盒资源
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle.FileHash))
|
||||
if (CacheSystem.ContainsVerifyFile(patchBundle))
|
||||
{
|
||||
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromCache);
|
||||
return bundleInfo;
|
||||
|
||||
Reference in New Issue
Block a user