mirror of https://github.com/tuyoogame/YooAsset
parent
e9fa3ead04
commit
c91c49465b
|
@ -6,6 +6,11 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
internal enum EVerifyResult
|
||||
{
|
||||
/// <summary>
|
||||
/// 验证异常
|
||||
/// </summary>
|
||||
Exception = -7,
|
||||
|
||||
/// <summary>
|
||||
/// 未找到缓存信息
|
||||
/// </summary>
|
||||
|
@ -37,9 +42,9 @@ namespace YooAsset
|
|||
FileCrcError = -1,
|
||||
|
||||
/// <summary>
|
||||
/// 验证异常
|
||||
/// 默认状态(校验未完成)
|
||||
/// </summary>
|
||||
Exception = 0,
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 验证成功
|
||||
|
|
|
@ -60,11 +60,12 @@ namespace YooAsset
|
|||
|
||||
if (_steps == ESteps.Waiting)
|
||||
{
|
||||
if (_element.IsDone == false)
|
||||
int result = _element.Result;
|
||||
if (result == 0)
|
||||
return;
|
||||
|
||||
VerifyResult = _element.Result;
|
||||
if (_element.Result == EVerifyResult.Succeed)
|
||||
VerifyResult = (EVerifyResult)result;
|
||||
if (VerifyResult == EVerifyResult.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
|
@ -73,7 +74,7 @@ namespace YooAsset
|
|||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Failed verify file : {_element.TempDataFilePath} ! ErrorCode : {_element.Result}";
|
||||
Error = $"Failed verify file : {_element.TempDataFilePath} ! ErrorCode : {VerifyResult}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,8 +86,8 @@ namespace YooAsset
|
|||
private void VerifyInThread(object obj)
|
||||
{
|
||||
VerifyTempElement element = (VerifyTempElement)obj;
|
||||
element.Result = CacheSystem.VerifyingTempFile(element);
|
||||
element.IsDone = true;
|
||||
int result = (int)CacheSystem.VerifyingTempFile(element);
|
||||
element.Result = result;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,11 +121,10 @@ namespace YooAsset
|
|||
|
||||
if (_steps == ESteps.VerifyFile)
|
||||
{
|
||||
_element.Result = CacheSystem.VerifyingTempFile(_element);
|
||||
_element.IsDone = true;
|
||||
_element.Result = (int)CacheSystem.VerifyingTempFile(_element);
|
||||
|
||||
VerifyResult = _element.Result;
|
||||
if (_element.Result == EVerifyResult.Succeed)
|
||||
VerifyResult = (EVerifyResult)_element.Result;
|
||||
if (VerifyResult == EVerifyResult.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
|
@ -133,7 +133,7 @@ namespace YooAsset
|
|||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Failed verify file : {_element.TempDataFilePath} ! ErrorCode : {_element.Result}";
|
||||
Error = $"Failed verify file : {_element.TempDataFilePath} ! ErrorCode : {VerifyResult}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,8 +49,7 @@ namespace YooAsset
|
|||
public string FileCRC { private set; get; }
|
||||
public long FileSize { private set; get; }
|
||||
|
||||
public bool IsDone = false;
|
||||
public EVerifyResult Result;
|
||||
public int Result = 0; // 注意:原子操作对象
|
||||
|
||||
public VerifyTempElement(string tempDataFilePath, string fileCRC, long fileSize)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue