mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-30 05:28:46 +00:00
Update download system
This commit is contained in:
@@ -154,6 +154,8 @@ namespace YooAsset
|
|||||||
return CheckContentIntegrity(filePath, patchBundle.SizeBytes, patchBundle.CRC);
|
return CheckContentIntegrity(filePath, patchBundle.SizeBytes, patchBundle.CRC);
|
||||||
}
|
}
|
||||||
public static bool CheckContentIntegrity(string filePath, long size, string crc)
|
public static bool CheckContentIntegrity(string filePath, long size, string crc)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (File.Exists(filePath) == false)
|
if (File.Exists(filePath) == false)
|
||||||
return false;
|
return false;
|
||||||
@@ -167,5 +169,10 @@ namespace YooAsset
|
|||||||
string fileCRC = HashUtility.FileCRC32(filePath);
|
string fileCRC = HashUtility.FileCRC32(filePath);
|
||||||
return fileCRC == crc;
|
return fileCRC == crc;
|
||||||
}
|
}
|
||||||
|
catch(Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -332,16 +332,8 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
private void VerifyInThread(object infoObj)
|
private void VerifyInThread(object infoObj)
|
||||||
{
|
{
|
||||||
// 验证沙盒内的文件
|
|
||||||
ThreadInfo info = (ThreadInfo)infoObj;
|
ThreadInfo info = (ThreadInfo)infoObj;
|
||||||
try
|
|
||||||
{
|
|
||||||
info.Result = DownloadSystem.CheckContentIntegrity(info.FilePath, info.Bundle.SizeBytes, info.Bundle.CRC);
|
info.Result = DownloadSystem.CheckContentIntegrity(info.FilePath, info.Bundle.SizeBytes, info.Bundle.CRC);
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
info.Result = false;
|
|
||||||
}
|
|
||||||
_syncContext.Post(VerifyCallback, info);
|
_syncContext.Post(VerifyCallback, info);
|
||||||
}
|
}
|
||||||
private void VerifyCallback(object obj)
|
private void VerifyCallback(object obj)
|
||||||
|
|||||||
Reference in New Issue
Block a user