com.alicizax.unity.tuyoogam.../Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs

630 lines
24 KiB
C#
Raw Normal View History

2025-01-09 11:31:04 +08:00
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
2025-09-10 16:04:39 +08:00
using UnityEngine;
2025-01-09 11:31:04 +08:00
namespace YooAsset
{
/// <summary>
/// 缓存文件系统
/// 说明正在进行的下载器会在ResourcePackage销毁的时候执行Abort操作
/// </summary>
internal class DefaultCacheFileSystem : IFileSystem
{
2025-02-28 16:11:01 +08:00
protected readonly Dictionary<string, RecordFileElement> _records = new Dictionary<string, RecordFileElement>(10000);
protected readonly Dictionary<string, string> _bundleDataFilePathMapping = new Dictionary<string, string>(10000);
protected readonly Dictionary<string, string> _bundleInfoFilePathMapping = new Dictionary<string, string>(10000);
protected readonly Dictionary<string, string> _tempFilePathMapping = new Dictionary<string, string>(10000);
2025-01-09 11:31:04 +08:00
protected string _packageRoot;
protected string _tempFilesRoot;
protected string _cacheBundleFilesRoot;
protected string _cacheManifestFilesRoot;
2025-02-28 16:11:01 +08:00
/// <summary>
/// 下载中心
/// 说明:当异步操作任务终止的时候,所有下载子任务都会一同被终止!
/// </summary>
public DownloadCenterOperation DownloadCenter { set; get; }
2025-01-09 11:31:04 +08:00
/// <summary>
/// 包裹名称
/// </summary>
public string PackageName { private set; get; }
/// <summary>
/// 文件根目录
/// </summary>
public string FileRoot
{
get
{
return _packageRoot;
}
}
/// <summary>
/// 文件数量
/// </summary>
public int FileCount
{
get
{
2025-02-28 16:11:01 +08:00
return _records.Count;
2025-01-09 11:31:04 +08:00
}
}
#region
/// <summary>
/// 自定义参数:远程服务接口
/// </summary>
2025-09-02 19:21:49 +08:00
public IRemoteServices RemoteServices { private set; get; }
2025-01-09 11:31:04 +08:00
2025-09-10 16:04:39 +08:00
/// <summary>
/// 自定义参数:覆盖安装缓存清理模式
/// </summary>
public EOverwriteInstallClearMode InstallClearMode { private set; get; } = EOverwriteInstallClearMode.ClearAllManifestFiles;
2025-01-09 11:31:04 +08:00
/// <summary>
/// 自定义参数:初始化的时候缓存文件校验级别
/// </summary>
public EFileVerifyLevel FileVerifyLevel { private set; get; } = EFileVerifyLevel.Middle;
2025-04-01 21:12:28 +08:00
/// <summary>
2025-09-10 16:04:39 +08:00
/// 自定义参数:初始化的时候缓存文件校验最大并发数
2025-04-01 21:12:28 +08:00
/// </summary>
2025-09-10 16:04:39 +08:00
public int FileVerifyMaxConcurrency { private set; get; } = int.MaxValue;
2025-04-01 21:12:28 +08:00
2025-01-09 11:31:04 +08:00
/// <summary>
/// 自定义参数:数据文件追加文件格式
/// </summary>
public bool AppendFileExtension { private set; get; } = false;
2025-09-02 19:21:49 +08:00
/// <summary>
/// 自定义参数:禁用边玩边下机制
/// </summary>
public bool DisableOnDemandDownload { private set; get; } = false;
2025-01-09 11:31:04 +08:00
/// <summary>
/// 自定义参数:最大并发连接数
/// </summary>
public int DownloadMaxConcurrency { private set; get; } = int.MaxValue;
/// <summary>
/// 自定义参数:每帧发起的最大请求数
/// </summary>
public int DownloadMaxRequestPerFrame { private set; get; } = int.MaxValue;
/// <summary>
/// 自定义参数:启用断点续传的最小尺寸
/// </summary>
public long ResumeDownloadMinimumSize { private set; get; } = long.MaxValue;
/// <summary>
/// 自定义参数:断点续传下载器关注的错误码
/// </summary>
public List<long> ResumeDownloadResponseCodes { private set; get; } = null;
/// <summary>
/// 自定义参数:解密方法类
/// </summary>
public IDecryptionServices DecryptionServices { private set; get; }
2025-09-02 19:21:49 +08:00
/// <summary>
/// 自定义参数:资源清单服务类
/// </summary>
public IManifestRestoreServices ManifestServices { private set; get; }
/// <summary>
/// 自定义参数:拷贝内置文件服务类
/// </summary>
public ICopyLocalFileServices CopyLocalFileServices { private set; get; }
2025-01-09 11:31:04 +08:00
#endregion
public DefaultCacheFileSystem()
{
}
public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync()
{
var operation = new DCFSInitializeOperation(this);
return operation;
}
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout)
{
var operation = new DCFSLoadPackageManifestOperation(this, packageVersion, timeout);
return operation;
}
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
{
var operation = new DCFSRequestPackageVersionOperation(this, appendTimeTicks, timeout);
return operation;
}
2025-05-13 10:40:30 +08:00
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options)
2025-01-09 11:31:04 +08:00
{
2025-05-13 10:40:30 +08:00
if (options.ClearMode == EFileClearMode.ClearAllBundleFiles.ToString())
2025-01-09 11:31:04 +08:00
{
var operation = new ClearAllCacheBundleFilesOperation(this);
return operation;
}
2025-05-13 10:40:30 +08:00
else if (options.ClearMode == EFileClearMode.ClearUnusedBundleFiles.ToString())
2025-01-09 11:31:04 +08:00
{
var operation = new ClearUnusedCacheBundleFilesOperation(this, manifest);
return operation;
}
2025-05-13 10:40:30 +08:00
else if (options.ClearMode == EFileClearMode.ClearBundleFilesByTags.ToString())
2025-01-09 11:31:04 +08:00
{
2025-05-13 10:40:30 +08:00
var operation = new ClearCacheBundleFilesByTagsOperaiton(this, manifest, options.ClearParam);
2025-01-09 11:31:04 +08:00
return operation;
}
2025-05-13 10:40:30 +08:00
else if (options.ClearMode == EFileClearMode.ClearAllManifestFiles.ToString())
2025-01-09 11:31:04 +08:00
{
var operation = new ClearAllCacheManifestFilesOperation(this);
return operation;
}
2025-05-13 10:40:30 +08:00
else if (options.ClearMode == EFileClearMode.ClearUnusedManifestFiles.ToString())
2025-01-09 11:31:04 +08:00
{
var operation = new ClearUnusedCacheManifestFilesOperation(this, manifest);
return operation;
}
else
{
2025-05-13 10:40:30 +08:00
string error = $"Invalid clear mode : {options.ClearMode}";
2025-01-09 11:31:04 +08:00
var operation = new FSClearCacheFilesCompleteOperation(error);
return operation;
}
}
2025-05-13 10:40:30 +08:00
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
2025-01-09 11:31:04 +08:00
{
2025-09-02 19:21:49 +08:00
// 获取下载地址
if (string.IsNullOrEmpty(options.ImportFilePath))
{
// 注意:如果是解压文件系统类,这里会返回本地内置文件的下载路径
string mainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
string fallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
options.SetURL(mainURL, fallbackURL);
}
else
{
// 注意:把本地导入文件路径转换为下载器请求地址
string mainURL = DownloadSystemHelper.ConvertToWWWPath(options.ImportFilePath);
options.SetURL(mainURL, mainURL);
}
2025-02-28 16:11:01 +08:00
2025-09-02 19:21:49 +08:00
var downloader = new DownloadPackageBundleOperation(this, bundle, options);
return downloader;
2025-01-09 11:31:04 +08:00
}
public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
{
if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
{
var operation = new DCFSLoadAssetBundleOperation(this, bundle);
return operation;
}
else if (bundle.BundleType == (int)EBuildBundleType.RawBundle)
{
var operation = new DCFSLoadRawBundleOperation(this, bundle);
return operation;
}
else
{
string error = $"{nameof(DefaultCacheFileSystem)} not support load bundle type : {bundle.BundleType}";
var operation = new FSLoadBundleCompleteOperation(error);
return operation;
}
}
public virtual void SetParameter(string name, object value)
{
if (name == FileSystemParametersDefine.REMOTE_SERVICES)
{
RemoteServices = (IRemoteServices)value;
}
2025-09-10 16:04:39 +08:00
else if (name == FileSystemParametersDefine.INSTALL_CLEAR_MODE)
{
InstallClearMode = (EOverwriteInstallClearMode)value;
}
2025-01-09 11:31:04 +08:00
else if (name == FileSystemParametersDefine.FILE_VERIFY_LEVEL)
{
FileVerifyLevel = (EFileVerifyLevel)value;
}
2025-09-10 16:04:39 +08:00
else if (name == FileSystemParametersDefine.FILE_VERIFY_MAX_CONCURRENCY)
2025-04-01 21:12:28 +08:00
{
2025-09-10 16:04:39 +08:00
int convertValue = Convert.ToInt32(value);
FileVerifyMaxConcurrency = Mathf.Clamp(convertValue, 1, int.MaxValue);
2025-04-01 21:12:28 +08:00
}
2025-01-09 11:31:04 +08:00
else if (name == FileSystemParametersDefine.APPEND_FILE_EXTENSION)
{
2025-04-01 21:12:28 +08:00
AppendFileExtension = Convert.ToBoolean(value);
2025-01-09 11:31:04 +08:00
}
2025-09-02 19:21:49 +08:00
else if (name == FileSystemParametersDefine.DISABLE_ONDEMAND_DOWNLOAD)
{
DisableOnDemandDownload = Convert.ToBoolean(value);
}
2025-01-09 11:31:04 +08:00
else if (name == FileSystemParametersDefine.DOWNLOAD_MAX_CONCURRENCY)
{
2025-09-10 16:04:39 +08:00
int convertValue = Convert.ToInt32(value);
DownloadMaxConcurrency = Mathf.Clamp(convertValue, 1, int.MaxValue);
2025-01-09 11:31:04 +08:00
}
else if (name == FileSystemParametersDefine.DOWNLOAD_MAX_REQUEST_PER_FRAME)
{
2025-09-10 16:04:39 +08:00
int convertValue = Convert.ToInt32(value);
DownloadMaxRequestPerFrame = Mathf.Clamp(convertValue, 1, int.MaxValue);
2025-01-09 11:31:04 +08:00
}
else if (name == FileSystemParametersDefine.RESUME_DOWNLOAD_MINMUM_SIZE)
{
2025-04-01 21:12:28 +08:00
ResumeDownloadMinimumSize = Convert.ToInt64(value);
2025-01-09 11:31:04 +08:00
}
else if (name == FileSystemParametersDefine.RESUME_DOWNLOAD_RESPONSE_CODES)
{
ResumeDownloadResponseCodes = (List<long>)value;
}
else if (name == FileSystemParametersDefine.DECRYPTION_SERVICES)
{
DecryptionServices = (IDecryptionServices)value;
}
2025-09-02 19:21:49 +08:00
else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
{
ManifestServices = (IManifestRestoreServices)value;
}
else if (name == FileSystemParametersDefine.COPY_LOCAL_FILE_SERVICES)
{
CopyLocalFileServices = (ICopyLocalFileServices)value;
}
2025-01-09 11:31:04 +08:00
else
{
YooLogger.Warning($"Invalid parameter : {name}");
}
}
public virtual void OnCreate(string packageName, string packageRoot)
{
PackageName = packageName;
if (string.IsNullOrEmpty(packageRoot))
_packageRoot = GetDefaultCachePackageRoot(packageName);
else
_packageRoot = packageRoot;
_cacheBundleFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.BundleFilesFolderName);
_cacheManifestFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.ManifestFilesFolderName);
2025-04-01 21:12:28 +08:00
_tempFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.TempFilesFolderName);
2025-01-09 11:31:04 +08:00
}
2025-02-28 16:11:01 +08:00
public virtual void OnDestroy()
2025-01-09 11:31:04 +08:00
{
2025-02-28 16:11:01 +08:00
if (DownloadCenter != null)
{
DownloadCenter.AbortOperation();
DownloadCenter = null;
}
2025-01-09 11:31:04 +08:00
}
public virtual bool Belong(PackageBundle bundle)
{
// 注意:缓存文件系统保底加载!
return true;
}
public virtual bool Exists(PackageBundle bundle)
{
2025-02-28 16:11:01 +08:00
return _records.ContainsKey(bundle.BundleGUID);
2025-01-09 11:31:04 +08:00
}
public virtual bool NeedDownload(PackageBundle bundle)
{
if (Belong(bundle) == false)
return false;
return Exists(bundle) == false;
}
public virtual bool NeedUnpack(PackageBundle bundle)
{
return false;
}
public virtual bool NeedImport(PackageBundle bundle)
{
if (Belong(bundle) == false)
return false;
return Exists(bundle) == false;
}
public virtual string GetBundleFilePath(PackageBundle bundle)
{
return GetCacheBundleFileLoadPath(bundle);
}
public virtual byte[] ReadBundleFileData(PackageBundle bundle)
{
if (Exists(bundle) == false)
return null;
if (bundle.Encrypted)
{
if (DecryptionServices == null)
{
YooLogger.Error($"The {nameof(IDecryptionServices)} is null !");
return null;
}
string filePath = GetCacheBundleFileLoadPath(bundle);
var fileInfo = new DecryptFileInfo()
{
BundleName = bundle.BundleName,
FileLoadCRC = bundle.UnityCRC,
FileLoadPath = filePath,
};
return DecryptionServices.ReadFileData(fileInfo);
}
else
{
string filePath = GetCacheBundleFileLoadPath(bundle);
return FileUtility.ReadAllBytes(filePath);
}
}
public virtual string ReadBundleFileText(PackageBundle bundle)
{
if (Exists(bundle) == false)
return null;
if (bundle.Encrypted)
{
if (DecryptionServices == null)
{
YooLogger.Error($"The {nameof(IDecryptionServices)} is null !");
return null;
}
string filePath = GetCacheBundleFileLoadPath(bundle);
var fileInfo = new DecryptFileInfo()
{
BundleName = bundle.BundleName,
FileLoadCRC = bundle.UnityCRC,
FileLoadPath = filePath,
};
return DecryptionServices.ReadFileText(fileInfo);
}
else
{
string filePath = GetCacheBundleFileLoadPath(bundle);
return FileUtility.ReadAllText(filePath);
}
}
#region
public List<string> GetAllCachedBundleGUIDs()
{
2025-02-28 16:11:01 +08:00
return _records.Keys.ToList();
2025-01-09 11:31:04 +08:00
}
2025-04-01 21:12:28 +08:00
public RecordFileElement GetRecordFileElement(PackageBundle bundle)
{
if (_records.TryGetValue(bundle.BundleGUID, out RecordFileElement element))
return element;
else
return null;
}
2025-01-09 11:31:04 +08:00
public string GetTempFilePath(PackageBundle bundle)
{
2025-02-28 16:11:01 +08:00
if (_tempFilePathMapping.TryGetValue(bundle.BundleGUID, out string filePath) == false)
2025-01-09 11:31:04 +08:00
{
filePath = PathUtility.Combine(_tempFilesRoot, bundle.BundleGUID);
2025-02-28 16:11:01 +08:00
_tempFilePathMapping.Add(bundle.BundleGUID, filePath);
2025-01-09 11:31:04 +08:00
}
return filePath;
}
public string GetBundleDataFilePath(PackageBundle bundle)
{
2025-02-28 16:11:01 +08:00
if (_bundleDataFilePathMapping.TryGetValue(bundle.BundleGUID, out string filePath) == false)
2025-01-09 11:31:04 +08:00
{
string folderName = bundle.FileHash.Substring(0, 2);
filePath = PathUtility.Combine(_cacheBundleFilesRoot, folderName, bundle.BundleGUID, DefaultCacheFileSystemDefine.BundleDataFileName);
if (AppendFileExtension)
filePath += bundle.FileExtension;
2025-02-28 16:11:01 +08:00
_bundleDataFilePathMapping.Add(bundle.BundleGUID, filePath);
2025-01-09 11:31:04 +08:00
}
return filePath;
}
public string GetBundleInfoFilePath(PackageBundle bundle)
{
2025-02-28 16:11:01 +08:00
if (_bundleInfoFilePathMapping.TryGetValue(bundle.BundleGUID, out string filePath) == false)
2025-01-09 11:31:04 +08:00
{
string folderName = bundle.FileHash.Substring(0, 2);
filePath = PathUtility.Combine(_cacheBundleFilesRoot, folderName, bundle.BundleGUID, DefaultCacheFileSystemDefine.BundleInfoFileName);
2025-02-28 16:11:01 +08:00
_bundleInfoFilePathMapping.Add(bundle.BundleGUID, filePath);
2025-01-09 11:31:04 +08:00
}
return filePath;
}
public bool IsRecordBundleFile(string bundleGUID)
{
2025-02-28 16:11:01 +08:00
return _records.ContainsKey(bundleGUID);
2025-01-09 11:31:04 +08:00
}
public bool RecordBundleFile(string bundleGUID, RecordFileElement element)
{
2025-02-28 16:11:01 +08:00
if (_records.ContainsKey(bundleGUID))
2025-01-09 11:31:04 +08:00
{
2025-02-28 16:11:01 +08:00
YooLogger.Error($"{nameof(DefaultCacheFileSystem)} has element : {bundleGUID}");
2025-01-09 11:31:04 +08:00
return false;
}
2025-02-28 16:11:01 +08:00
_records.Add(bundleGUID, element);
2025-01-09 11:31:04 +08:00
return true;
}
public EFileVerifyResult VerifyCacheFile(PackageBundle bundle)
{
2025-04-01 21:12:28 +08:00
if (_records.TryGetValue(bundle.BundleGUID, out RecordFileElement element) == false)
2025-01-09 11:31:04 +08:00
return EFileVerifyResult.CacheNotFound;
2025-04-01 21:12:28 +08:00
EFileVerifyResult result = FileVerifyHelper.FileVerify(element.DataFilePath, element.DataFileSize, element.DataFileCRC, EFileVerifyLevel.High);
2025-01-09 11:31:04 +08:00
return result;
}
public bool WriteCacheBundleFile(PackageBundle bundle, string copyPath)
{
2025-02-28 16:11:01 +08:00
if (_records.ContainsKey(bundle.BundleGUID))
2025-01-09 11:31:04 +08:00
{
throw new Exception("Should never get here !");
}
string infoFilePath = GetBundleInfoFilePath(bundle);
string dataFilePath = GetBundleDataFilePath(bundle);
try
{
if (File.Exists(infoFilePath))
File.Delete(infoFilePath);
if (File.Exists(dataFilePath))
File.Delete(dataFilePath);
FileUtility.CreateFileDirectory(dataFilePath);
// 拷贝数据文件
FileInfo fileInfo = new FileInfo(copyPath);
fileInfo.CopyTo(dataFilePath);
// 写入文件信息
WriteBundleInfoFile(infoFilePath, bundle.FileCRC, bundle.FileSize);
}
catch (Exception e)
{
YooLogger.Error($"Failed to write cache file ! {e.Message}");
return false;
}
var recordFileElement = new RecordFileElement(infoFilePath, dataFilePath, bundle.FileCRC, bundle.FileSize);
return RecordBundleFile(bundle.BundleGUID, recordFileElement);
}
public bool DeleteCacheBundleFile(string bundleGUID)
{
2025-04-01 21:12:28 +08:00
if (_records.TryGetValue(bundleGUID, out RecordFileElement element))
2025-01-09 11:31:04 +08:00
{
2025-04-01 21:12:28 +08:00
_records.Remove(bundleGUID);
return element.DeleteFolder();
2025-01-09 11:31:04 +08:00
}
else
{
return false;
}
}
private readonly BufferWriter _sharedBuffer = new BufferWriter(1024);
2025-09-10 16:04:39 +08:00
public void WriteBundleInfoFile(string filePath, uint dataFileCRC, long dataFileSize)
2025-01-09 11:31:04 +08:00
{
using (FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.Read))
{
_sharedBuffer.Clear();
2025-09-10 16:04:39 +08:00
_sharedBuffer.WriteUInt32(dataFileCRC);
2025-01-09 11:31:04 +08:00
_sharedBuffer.WriteInt64(dataFileSize);
_sharedBuffer.WriteToStream(fs);
fs.Flush();
}
}
2025-09-10 16:04:39 +08:00
public void ReadBundleInfoFile(string filePath, out uint dataFileCRC, out long dataFileSize)
2025-01-09 11:31:04 +08:00
{
byte[] binaryData = FileUtility.ReadAllBytes(filePath);
BufferReader buffer = new BufferReader(binaryData);
2025-09-10 16:04:39 +08:00
dataFileCRC = buffer.ReadUInt32();
2025-01-09 11:31:04 +08:00
dataFileSize = buffer.ReadInt64();
}
#endregion
#region
public string GetDefaultCachePackageRoot(string packageName)
{
2025-02-28 16:11:01 +08:00
string rootDirectory = YooAssetSettingsData.GetYooDefaultCacheRoot();
2025-01-09 11:31:04 +08:00
return PathUtility.Combine(rootDirectory, packageName);
}
public string GetCacheBundleFileLoadPath(PackageBundle bundle)
{
return GetBundleDataFilePath(bundle);
}
public string GetCachePackageHashFilePath(string packageVersion)
{
string fileName = YooAssetSettingsData.GetPackageHashFileName(PackageName, packageVersion);
return PathUtility.Combine(_cacheManifestFilesRoot, fileName);
}
public string GetCachePackageManifestFilePath(string packageVersion)
{
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(PackageName, packageVersion);
return PathUtility.Combine(_cacheManifestFilesRoot, fileName);
}
public string GetSandboxAppFootPrintFilePath()
{
return PathUtility.Combine(_cacheManifestFilesRoot, DefaultCacheFileSystemDefine.AppFootPrintFileName);
}
public string GetCacheBundleFilesRoot()
{
return _cacheBundleFilesRoot;
}
public string GetCacheManifestFilesRoot()
{
return _cacheManifestFilesRoot;
}
/// <summary>
2025-04-01 21:12:28 +08:00
/// 删除所有缓存的资源文件
/// </summary>
public void DeleteAllBundleFiles()
{
if (Directory.Exists(_cacheBundleFilesRoot))
{
Directory.Delete(_cacheBundleFilesRoot, true);
}
}
/// <summary>
/// 删除所有缓存的清单文件
2025-01-09 11:31:04 +08:00
/// </summary>
public void DeleteAllManifestFiles()
{
if (Directory.Exists(_cacheManifestFilesRoot))
{
Directory.Delete(_cacheManifestFilesRoot, true);
}
}
/// <summary>
/// 加载加密资源文件
/// </summary>
public DecryptResult LoadEncryptedAssetBundle(PackageBundle bundle)
{
string filePath = GetCacheBundleFileLoadPath(bundle);
var fileInfo = new DecryptFileInfo()
{
BundleName = bundle.BundleName,
FileLoadCRC = bundle.UnityCRC,
FileLoadPath = filePath,
};
return DecryptionServices.LoadAssetBundle(fileInfo);
}
/// <summary>
/// 加载加密资源文件
/// </summary>
public DecryptResult LoadEncryptedAssetBundleAsync(PackageBundle bundle)
{
string filePath = GetCacheBundleFileLoadPath(bundle);
var fileInfo = new DecryptFileInfo()
{
BundleName = bundle.BundleName,
FileLoadCRC = bundle.UnityCRC,
FileLoadPath = filePath,
};
return DecryptionServices.LoadAssetBundleAsync(fileInfo);
}
2025-09-02 19:21:49 +08:00
/// <summary>
/// 加载加密资源文件
/// </summary>
public DecryptResult LoadEncryptedAssetBundleFallback(PackageBundle bundle)
{
string filePath = GetCacheBundleFileLoadPath(bundle);
var fileInfo = new DecryptFileInfo()
{
BundleName = bundle.BundleName,
FileLoadCRC = bundle.UnityCRC,
FileLoadPath = filePath,
};
return DecryptionServices.LoadAssetBundleFallback(fileInfo);
}
2025-01-09 11:31:04 +08:00
#endregion
}
}