parent
fb4910e265
commit
4975d3b1ba
|
@ -40,21 +40,6 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
public string ContentHash { set; get; } = "00000000000000000000000000000000"; //32位
|
||||
|
||||
/// <summary>
|
||||
/// 文件哈希值
|
||||
/// </summary>
|
||||
public string FileHash { set; get; } = "00000000000000000000000000000000"; //32位
|
||||
|
||||
/// <summary>
|
||||
/// 文件CRC32
|
||||
/// </summary>
|
||||
public string FileCRC { set; get; } = "00000000"; //8位
|
||||
|
||||
/// <summary>
|
||||
/// 文件大小
|
||||
/// </summary>
|
||||
public long FileSize { set; get; } = 0;
|
||||
|
||||
|
||||
public BuildBundleInfo(string bundleName)
|
||||
{
|
||||
|
|
|
@ -68,13 +68,10 @@ namespace YooAsset.Editor
|
|||
{
|
||||
foreach (var bundleInfo in buildMapContext.BundleInfos)
|
||||
{
|
||||
string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
|
||||
bundleInfo.FileHash = HashUtility.FileMD5(filePath);
|
||||
bundleInfo.FileCRC = HashUtility.FileCRC32(filePath);
|
||||
bundleInfo.FileSize = FileUtility.GetFileSize(filePath);
|
||||
if (bundleInfo.IsRawFile)
|
||||
{
|
||||
bundleInfo.ContentHash = bundleInfo.FileHash;
|
||||
string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
|
||||
bundleInfo.ContentHash = HashUtility.FileMD5(filePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -79,13 +79,10 @@ namespace YooAsset.Editor
|
|||
{
|
||||
foreach (var bundleInfo in buildMapContext.BundleInfos)
|
||||
{
|
||||
string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
|
||||
bundleInfo.FileHash = HashUtility.FileMD5(filePath);
|
||||
bundleInfo.FileCRC = HashUtility.FileCRC32(filePath);
|
||||
bundleInfo.FileSize = FileUtility.GetFileSize(filePath);
|
||||
if (bundleInfo.IsRawFile)
|
||||
{
|
||||
bundleInfo.ContentHash = bundleInfo.FileHash;
|
||||
string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
|
||||
bundleInfo.ContentHash = HashUtility.FileMD5(filePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -74,9 +74,9 @@ namespace YooAsset.Editor
|
|||
foreach (var bundleInfo in buildMapContext.BundleInfos)
|
||||
{
|
||||
var bundleName = bundleInfo.BundleName;
|
||||
string fileHash = bundleInfo.FileHash;
|
||||
string fileCRC = bundleInfo.FileCRC;
|
||||
long fileSize = bundleInfo.FileSize;
|
||||
string fileHash = GetBundleFileHash(bundleInfo, buildParameters);
|
||||
string fileCRC = GetBundleFileCRC(bundleInfo, buildParameters);
|
||||
long fileSize = GetBundleFileSize(bundleInfo, buildParameters);
|
||||
string[] tags = buildMapContext.GetBundleTags(bundleName);
|
||||
bool isEncrypted = encryptionContext.IsEncryptFile(bundleName);
|
||||
bool isBuildin = IsBuildinBundle(tags, buildinTags);
|
||||
|
@ -102,6 +102,33 @@ namespace YooAsset.Editor
|
|||
}
|
||||
return false;
|
||||
}
|
||||
private string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||
{
|
||||
var buildMode = buildParametersContext.Parameters.BuildMode;
|
||||
if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
|
||||
return "00000000000000000000000000000000"; //32位
|
||||
|
||||
string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
|
||||
return HashUtility.FileMD5(filePath);
|
||||
}
|
||||
private string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||
{
|
||||
var buildMode = buildParametersContext.Parameters.BuildMode;
|
||||
if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
|
||||
return "00000000"; //8位
|
||||
|
||||
string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
|
||||
return HashUtility.FileCRC32(filePath);
|
||||
}
|
||||
private long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||
{
|
||||
var buildMode = buildParametersContext.Parameters.BuildMode;
|
||||
if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
|
||||
return 0;
|
||||
|
||||
string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
|
||||
return FileUtility.GetFileSize(filePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源列表
|
||||
|
|
Loading…
Reference in New Issue