修复断点续传失效的问题
pull/229/head
hevinci 2023-12-21 12:06:06 +08:00
parent 505d23ca07
commit 47962424eb
1 changed files with 11 additions and 6 deletions

View File

@ -90,12 +90,19 @@ namespace YooAsset
string fileRootPath = chidDirectory.FullName; string fileRootPath = chidDirectory.FullName;
string dataFilePath = $"{fileRootPath}/{ YooAssetSettings.CacheBundleDataFileName}"; string dataFilePath = $"{fileRootPath}/{ YooAssetSettings.CacheBundleDataFileName}";
string infoFilePath = $"{fileRootPath}/{ YooAssetSettings.CacheBundleInfoFileName}"; string infoFilePath = $"{fileRootPath}/{ YooAssetSettings.CacheBundleInfoFileName}";
string dataFileExtension = FindDataFileExtension(chidDirectory);
// 跳过断点续传的临时文件
if (dataFileExtension == ".temp")
continue;
// 注意:根据配置需求数据文件会带文件格式
if (_persistent.AppendFileExtension) if (_persistent.AppendFileExtension)
{ {
string fileExtension = FindFileExtension(chidDirectory); if (string.IsNullOrEmpty(dataFileExtension) == false)
if (string.IsNullOrEmpty(fileExtension) == false) dataFilePath += dataFileExtension;
dataFilePath += fileExtension;
} }
VerifyCacheFileElement element = new VerifyCacheFileElement(_cache.PackageName, cacheGUID, fileRootPath, dataFilePath, infoFilePath); VerifyCacheFileElement element = new VerifyCacheFileElement(_cache.PackageName, cacheGUID, fileRootPath, dataFilePath, infoFilePath);
VerifyElements.Add(element); VerifyElements.Add(element);
} }
@ -106,14 +113,12 @@ namespace YooAsset
return isFindItem; return isFindItem;
} }
private string FindFileExtension(DirectoryInfo directoryInfo) private string FindDataFileExtension(DirectoryInfo directoryInfo)
{ {
string dataFileExtension = string.Empty; string dataFileExtension = string.Empty;
var fileInfos = directoryInfo.GetFiles(); var fileInfos = directoryInfo.GetFiles();
foreach (var fileInfo in fileInfos) foreach (var fileInfo in fileInfos)
{ {
if (fileInfo.Extension == ".temp")
continue;
if (fileInfo.Name.StartsWith(YooAssetSettings.CacheBundleDataFileName)) if (fileInfo.Name.StartsWith(YooAssetSettings.CacheBundleDataFileName))
{ {
dataFileExtension = fileInfo.Extension; dataFileExtension = fileInfo.Extension;