update query services interface

内置文件和分发文件查询方法参数里增加了文件哈希值
pull/229/head
hevinci 2023-12-21 16:10:54 +08:00
parent 47962424eb
commit 0e29e9823d
5 changed files with 566 additions and 547 deletions

View File

@ -496,6 +496,14 @@ namespace YooAsset.Editor
return fileInfo.Length; return fileInfo.Length;
} }
/// <summary>
/// 获取文件的哈希值
/// </summary>
public static string GetFileCRC32(string filePath)
{
return HashUtility.FileCRC32(filePath);
}
/// <summary> /// <summary>
/// 读取文件的所有文本内容 /// 读取文件的所有文本内容
/// </summary> /// </summary>

View File

@ -75,7 +75,7 @@ namespace YooAsset
{ {
if (_deliveryQueryServices == null) if (_deliveryQueryServices == null)
return false; return false;
return _deliveryQueryServices.Query(PackageName, packageBundle.FileName); return _deliveryQueryServices.Query(PackageName, packageBundle.FileName, packageBundle.FileCRC);
} }
private bool IsCachedPackageBundle(PackageBundle packageBundle) private bool IsCachedPackageBundle(PackageBundle packageBundle)
{ {
@ -83,7 +83,7 @@ namespace YooAsset
} }
private bool IsBuildinPackageBundle(PackageBundle packageBundle) private bool IsBuildinPackageBundle(PackageBundle packageBundle)
{ {
return _buildinQueryServices.Query(PackageName, packageBundle.FileName); return _buildinQueryServices.Query(PackageName, packageBundle.FileName, packageBundle.FileCRC);
} }
#region IPlayMode接口 #region IPlayMode接口

View File

@ -67,7 +67,7 @@ namespace YooAsset
// 查询相关 // 查询相关
private bool IsBuildinPackageBundle(PackageBundle packageBundle) private bool IsBuildinPackageBundle(PackageBundle packageBundle)
{ {
return _buildinQueryServices.Query(PackageName, packageBundle.FileName); return _buildinQueryServices.Query(PackageName, packageBundle.FileName, packageBundle.FileCRC);
} }
#region IPlayMode接口 #region IPlayMode接口

View File

@ -6,6 +6,10 @@ namespace YooAsset
/// <summary> /// <summary>
/// 查询是否为应用程序内置的资源文件 /// 查询是否为应用程序内置的资源文件
/// </summary> /// </summary>
bool Query(string packageName, string fileName); /// <param name="packageName">包裹名称</param>
/// <param name="fileName">文件名称(包含文件的后缀格式)</param>
/// <param name="fileCRC">文件哈希值</param>
/// <returns>返回查询结果</returns>
bool Query(string packageName, string fileName, string fileCRC);
} }
} }

View File

@ -6,11 +6,18 @@ namespace YooAsset
/// <summary> /// <summary>
/// 查询是否为开发者分发的资源文件 /// 查询是否为开发者分发的资源文件
/// </summary> /// </summary>
bool Query(string packageName, string fileName); /// <param name="packageName">包裹名称</param>
/// <param name="fileName">文件名称(包含文件的后缀格式)</param>
/// <param name="fileCRC">文件哈希值</param>
/// <returns>返回查询结果</returns>
bool Query(string packageName, string fileName, string fileCRC);
/// <summary> /// <summary>
/// 获取分发资源文件的路径 /// 获取分发资源文件的路径
/// </summary> /// </summary>
/// <param name="packageName">包裹名称</param>
/// <param name="fileName">文件名称(包含文件的后缀格式)</param>
/// <returns>返回资源文件的路径</returns>
string GetFilePath(string packageName, string fileName); string GetFilePath(string packageName, string fileName);
} }
} }