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