parent
295238cbb6
commit
ab96f3f28c
|
@ -23,6 +23,15 @@ namespace YooAsset
|
||||||
_cachedDic.Clear();
|
_cachedDic.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取缓存文件总数
|
||||||
|
/// </summary>
|
||||||
|
public static int GetCachedFilesCount(string packageName)
|
||||||
|
{
|
||||||
|
var cache = GetOrCreateCache(packageName);
|
||||||
|
return cache.GetCachedFilesCount();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询是否为验证文件
|
/// 查询是否为验证文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -101,17 +101,21 @@ namespace YooAsset
|
||||||
if (isFindItem == false)
|
if (isFindItem == false)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
var fileFoder = _bundleFilesEnumerator.Current;
|
var rootFoder = _bundleFilesEnumerator.Current;
|
||||||
string cacheGUID = fileFoder.Name;
|
var childDirectories = rootFoder.GetDirectories();
|
||||||
|
foreach(var chidDirectory in childDirectories)
|
||||||
|
{
|
||||||
|
string cacheGUID = chidDirectory.Name;
|
||||||
if (CacheSystem.IsCached(_packageName, cacheGUID))
|
if (CacheSystem.IsCached(_packageName, cacheGUID))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// 创建验证元素类
|
// 创建验证元素类
|
||||||
string fileRootPath = fileFoder.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}";
|
||||||
VerifyElement element = new VerifyElement(_packageName, cacheGUID, fileRootPath, dataFilePath, infoFilePath);
|
VerifyElement element = new VerifyElement(_packageName, cacheGUID, fileRootPath, dataFilePath, infoFilePath);
|
||||||
VerifyElements.Add(element);
|
VerifyElements.Add(element);
|
||||||
|
}
|
||||||
|
|
||||||
if (OperationSystem.IsBusy)
|
if (OperationSystem.IsBusy)
|
||||||
break;
|
break;
|
||||||
|
@ -131,19 +135,21 @@ namespace YooAsset
|
||||||
if (isFindItem == false)
|
if (isFindItem == false)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
var fileFoder = _rawFilesEnumerator.Current;
|
var rootFoder = _rawFilesEnumerator.Current;
|
||||||
string cacheGUID = fileFoder.Name;
|
var childDirectories = rootFoder.GetDirectories();
|
||||||
|
foreach (var chidDirectory in childDirectories)
|
||||||
|
{
|
||||||
|
string cacheGUID = chidDirectory.Name;
|
||||||
if (CacheSystem.IsCached(_packageName, cacheGUID))
|
if (CacheSystem.IsCached(_packageName, cacheGUID))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// 获取数据文件的后缀名
|
// 获取数据文件的后缀名
|
||||||
string dataFileExtension = string.Empty;
|
string dataFileExtension = string.Empty;
|
||||||
var fileInfos = fileFoder.GetFiles();
|
var fileInfos = chidDirectory.GetFiles();
|
||||||
foreach (var fileInfo in fileInfos)
|
foreach (var fileInfo in fileInfos)
|
||||||
{
|
{
|
||||||
if (fileInfo.Extension == ".temp")
|
if (fileInfo.Extension == ".temp")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (fileInfo.Name.StartsWith(YooAssetSettings.CacheBundleDataFileName))
|
if (fileInfo.Name.StartsWith(YooAssetSettings.CacheBundleDataFileName))
|
||||||
{
|
{
|
||||||
dataFileExtension = fileInfo.Extension;
|
dataFileExtension = fileInfo.Extension;
|
||||||
|
@ -152,11 +158,12 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建验证元素类
|
// 创建验证元素类
|
||||||
string fileRootPath = fileFoder.FullName;
|
string fileRootPath = chidDirectory.FullName;
|
||||||
string dataFilePath = $"{fileRootPath}/{ YooAssetSettings.CacheBundleDataFileName}{dataFileExtension}";
|
string dataFilePath = $"{fileRootPath}/{ YooAssetSettings.CacheBundleDataFileName}{dataFileExtension}";
|
||||||
string infoFilePath = $"{fileRootPath}/{ YooAssetSettings.CacheBundleInfoFileName}";
|
string infoFilePath = $"{fileRootPath}/{ YooAssetSettings.CacheBundleInfoFileName}";
|
||||||
VerifyElement element = new VerifyElement(_packageName, cacheGUID, fileRootPath, dataFilePath, infoFilePath);
|
VerifyElement element = new VerifyElement(_packageName, cacheGUID, fileRootPath, dataFilePath, infoFilePath);
|
||||||
VerifyElements.Add(element);
|
VerifyElements.Add(element);
|
||||||
|
}
|
||||||
|
|
||||||
if (OperationSystem.IsBusy)
|
if (OperationSystem.IsBusy)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -63,6 +63,9 @@ namespace YooAsset
|
||||||
// 注意:总是返回成功
|
// 注意:总是返回成功
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Succeed;
|
Status = EOperationStatus.Succeed;
|
||||||
|
|
||||||
|
int totalCount = CacheSystem.GetCachedFilesCount(_packageName);
|
||||||
|
YooLogger.Log($"Package '{_packageName}' cached files count : {totalCount}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,14 @@ namespace YooAsset
|
||||||
_wrappers.Clear();
|
_wrappers.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取缓存文件总数
|
||||||
|
/// </summary>
|
||||||
|
public int GetCachedFilesCount()
|
||||||
|
{
|
||||||
|
return _wrappers.Count;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询缓存记录
|
/// 查询缓存记录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -71,15 +71,16 @@ namespace YooAsset
|
||||||
if (string.IsNullOrEmpty(_cachedDataFilePath) == false)
|
if (string.IsNullOrEmpty(_cachedDataFilePath) == false)
|
||||||
return _cachedDataFilePath;
|
return _cachedDataFilePath;
|
||||||
|
|
||||||
|
string folderName = FileHash.Substring(0, 2);
|
||||||
if (IsRawFile)
|
if (IsRawFile)
|
||||||
{
|
{
|
||||||
string cacheRoot = PersistentHelper.GetCachedRawFileFolderPath(PackageName);
|
string cacheRoot = PersistentHelper.GetCachedRawFileFolderPath(PackageName);
|
||||||
_cachedDataFilePath = $"{cacheRoot}/{CacheGUID}/{YooAssetSettings.CacheBundleDataFileName}{_fileExtension}";
|
_cachedDataFilePath = $"{cacheRoot}/{folderName}/{CacheGUID}/{YooAssetSettings.CacheBundleDataFileName}{_fileExtension}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string cacheRoot = PersistentHelper.GetCachedBundleFileFolderPath(PackageName);
|
string cacheRoot = PersistentHelper.GetCachedBundleFileFolderPath(PackageName);
|
||||||
_cachedDataFilePath = $"{cacheRoot}/{CacheGUID}/{YooAssetSettings.CacheBundleDataFileName}";
|
_cachedDataFilePath = $"{cacheRoot}/{folderName}/{CacheGUID}/{YooAssetSettings.CacheBundleDataFileName}";
|
||||||
}
|
}
|
||||||
return _cachedDataFilePath;
|
return _cachedDataFilePath;
|
||||||
}
|
}
|
||||||
|
@ -96,15 +97,16 @@ namespace YooAsset
|
||||||
if (string.IsNullOrEmpty(_cachedInfoFilePath) == false)
|
if (string.IsNullOrEmpty(_cachedInfoFilePath) == false)
|
||||||
return _cachedInfoFilePath;
|
return _cachedInfoFilePath;
|
||||||
|
|
||||||
|
string folderName = FileHash.Substring(0, 2);
|
||||||
if (IsRawFile)
|
if (IsRawFile)
|
||||||
{
|
{
|
||||||
string cacheRoot = PersistentHelper.GetCachedRawFileFolderPath(PackageName);
|
string cacheRoot = PersistentHelper.GetCachedRawFileFolderPath(PackageName);
|
||||||
_cachedInfoFilePath = $"{cacheRoot}/{CacheGUID}/{YooAssetSettings.CacheBundleInfoFileName}";
|
_cachedInfoFilePath = $"{cacheRoot}/{folderName}/{CacheGUID}/{YooAssetSettings.CacheBundleInfoFileName}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string cacheRoot = PersistentHelper.GetCachedBundleFileFolderPath(PackageName);
|
string cacheRoot = PersistentHelper.GetCachedBundleFileFolderPath(PackageName);
|
||||||
_cachedInfoFilePath = $"{cacheRoot}/{CacheGUID}/{YooAssetSettings.CacheBundleInfoFileName}";
|
_cachedInfoFilePath = $"{cacheRoot}/{folderName}/{CacheGUID}/{YooAssetSettings.CacheBundleInfoFileName}";
|
||||||
}
|
}
|
||||||
return _cachedInfoFilePath;
|
return _cachedInfoFilePath;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue