diff --git a/Assets/YooAsset/Runtime/CacheSystem/EVerifyResult.cs b/Assets/YooAsset/Runtime/CacheSystem/EVerifyResult.cs
index a1dd0a0..553e4dd 100644
--- a/Assets/YooAsset/Runtime/CacheSystem/EVerifyResult.cs
+++ b/Assets/YooAsset/Runtime/CacheSystem/EVerifyResult.cs
@@ -6,6 +6,11 @@ namespace YooAsset
///
internal enum EVerifyResult
{
+ ///
+ /// 验证异常
+ ///
+ Exception = -7,
+
///
/// 未找到缓存信息
///
@@ -37,9 +42,9 @@ namespace YooAsset
FileCrcError = -1,
///
- /// 验证异常
+ /// 默认状态(校验未完成)
///
- Exception = 0,
+ None = 0,
///
/// 验证成功
diff --git a/Assets/YooAsset/Runtime/CacheSystem/Operations/Internal/VerifyTempFileOperation.cs b/Assets/YooAsset/Runtime/CacheSystem/Operations/Internal/VerifyTempFileOperation.cs
index 55cfdab..9539d59 100644
--- a/Assets/YooAsset/Runtime/CacheSystem/Operations/Internal/VerifyTempFileOperation.cs
+++ b/Assets/YooAsset/Runtime/CacheSystem/Operations/Internal/VerifyTempFileOperation.cs
@@ -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}";
}
}
}
diff --git a/Assets/YooAsset/Runtime/CacheSystem/VerifyElement.cs b/Assets/YooAsset/Runtime/CacheSystem/VerifyElement.cs
index 9e3841b..ffa4ca7 100644
--- a/Assets/YooAsset/Runtime/CacheSystem/VerifyElement.cs
+++ b/Assets/YooAsset/Runtime/CacheSystem/VerifyElement.cs
@@ -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)
{