Update patch manifest

This commit is contained in:
hevinci
2022-07-25 15:46:20 +08:00
parent e5c7bbdf52
commit d0b7ae020c
10 changed files with 86 additions and 35 deletions
@@ -88,7 +88,7 @@ namespace YooAsset
// 创建新的下载器
{
YooLogger.Log($"Beginning to download file : {bundleInfo.BundleName} URL : {bundleInfo.RemoteMainURL}");
YooLogger.Log($"Beginning to download file : {bundleInfo.FileName} URL : {bundleInfo.RemoteMainURL}");
FileUtility.CreateFileDirectory(bundleInfo.GetCacheLoadPath());
DownloaderBase newDownloader;
if (bundleInfo.SizeBytes >= _breakpointResumeFileSize)
@@ -117,16 +117,16 @@ namespace YooAsset
{
if (_cachedHashList.ContainsKey(hash))
{
string filePath = SandboxHelper.MakeCacheFilePath(hash);
string fileName = _cachedHashList[hash];
string filePath = SandboxHelper.MakeCacheFilePath(fileName);
if (File.Exists(filePath))
{
return true;
}
else
{
string bundleName = _cachedHashList[hash];
_cachedHashList.Remove(hash);
YooLogger.Error($"Cache file is missing : {bundleName} Hash : {hash}");
YooLogger.Error($"Cache file is missing : {fileName}");
return false;
}
}
@@ -139,12 +139,12 @@ namespace YooAsset
/// <summary>
/// 缓存验证过的文件
/// </summary>
public static void CacheVerifyFile(string hash, string bundleName)
public static void CacheVerifyFile(string hash, string fileName)
{
if (_cachedHashList.ContainsKey(hash) == false)
{
YooLogger.Log($"Cache verify file : {bundleName} Hash : {hash}");
_cachedHashList.Add(hash, bundleName);
YooLogger.Log($"Cache verify file : {fileName}");
_cachedHashList.Add(hash, fileName);
}
}
@@ -80,8 +80,7 @@ namespace YooAsset
// 检查文件完整性
if (hasError == false)
{
// 注意:如果文件验证失败需要删除文件
// 注意:如果文件验证失败需要删除文件
if (DownloadSystem.CheckContentIntegrity(_bundleInfo.GetCacheLoadPath(), _bundleInfo.SizeBytes, _bundleInfo.CRC) == false)
{
hasError = true;
@@ -92,7 +91,7 @@ namespace YooAsset
if (hasError == false)
{
_steps = ESteps.Succeed;
DownloadSystem.CacheVerifyFile(_bundleInfo.Hash, _bundleInfo.BundleName);
DownloadSystem.CacheVerifyFile(_bundleInfo.Hash, _bundleInfo.FileName);
}
else
{
@@ -21,7 +21,7 @@ namespace YooAsset
private bool _running = true;
private string _url;
private string _savePath;
private string _fileHash;
private string _fileName;
private string _fileCRC;
private long _fileSize;
private int _timeout;
@@ -50,11 +50,11 @@ namespace YooAsset
/// <summary>
/// 开始下载
/// </summary>
public void Run(string url, string savePath, string fileHash, string fileCRC, long fileSize, int timeout)
public void Run(string url, string savePath, string fileName, string fileCRC, long fileSize, int timeout)
{
_url = url;
_savePath = savePath;
_fileHash = fileHash;
_fileName = fileName;
_fileCRC = fileCRC;
_fileSize = fileSize;
_timeout = timeout;
@@ -159,14 +159,14 @@ namespace YooAsset
bool verfiyResult = DownloadSystem.CheckContentIntegrity(_savePath, _fileSize, _fileCRC);
if (verfiyResult == false)
{
Error = $"Verify download content failed : {_fileHash}";
Error = $"Verify download content failed : {_fileName}";
if (File.Exists(_savePath))
File.Delete(_savePath);
}
}
else
{
Error = $"Download content is incomplete : {_fileHash}";
Error = $"Download content is incomplete : {_fileName}";
}
IsDone = true;
@@ -197,7 +197,7 @@ namespace YooAsset
_requestURL = GetRequestURL();
_threadDownloader = new ThreadDownloader();
_threadDownloader.Run(_requestURL, _bundleInfo.GetCacheLoadPath(), _bundleInfo.Hash, _bundleInfo.CRC, _bundleInfo.SizeBytes, _timeout);
_threadDownloader.Run(_requestURL, _bundleInfo.GetCacheLoadPath(), _bundleInfo.FileName, _bundleInfo.CRC, _bundleInfo.SizeBytes, _timeout);
_steps = ESteps.CheckDownload;
}
@@ -226,7 +226,7 @@ namespace YooAsset
}
else
{
DownloadSystem.CacheVerifyFile(_bundleInfo.Hash, _bundleInfo.BundleName);
DownloadSystem.CacheVerifyFile(_bundleInfo.Hash, _bundleInfo.FileName);
_steps = ESteps.Succeed;
}
}