Update runtime code

重写了文件解密流程。
This commit is contained in:
hevinci
2022-11-02 21:54:44 +08:00
parent 3e4761a60f
commit e8e69a2e86
12 changed files with 302 additions and 108 deletions
@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.IO;
namespace YooAsset
{
@@ -27,27 +26,21 @@ namespace YooAsset
/// </summary>
public long FileSize;
/// <summary>
/// 是否为原生文件
/// </summary>
public bool IsRawFile;
/// <summary>
/// 加载方法
/// </summary>
public byte LoadMethod;
/// <summary>
/// 资源包的分类标签
/// </summary>
public string[] Tags;
/// <summary>
/// Flags
/// </summary>
public int Flags;
/// <summary>
/// 是否为原生文件
/// </summary>
public bool IsRawFile { private set; get; }
/// <summary>
/// 是否为加密文件
/// </summary>
public bool IsEncrypted { private set; get; }
/// <summary>
/// 文件名称
/// </summary>
@@ -87,37 +80,15 @@ namespace YooAsset
}
public PatchBundle(string bundleName, string fileHash, string fileCRC, long fileSize, string[] tags)
public PatchBundle(string bundleName, string fileHash, string fileCRC, long fileSize, bool isRawFile, byte loadMethod, string[] tags)
{
BundleName = bundleName;
FileHash = fileHash;
FileCRC = fileCRC;
FileSize = fileSize;
Tags = tags;
}
/// <summary>
/// 设置Flags
/// </summary>
public void SetFlagsValue(bool isRawFile, bool isEncrypted)
{
IsRawFile = isRawFile;
IsEncrypted = isEncrypted;
BitMask32 mask = new BitMask32(0);
if (isRawFile) mask.Open(0);
if (isEncrypted) mask.Open(1);
Flags = mask;
}
/// <summary>
/// 解析Flags
/// </summary>
public void ParseFlagsValue()
{
BitMask32 value = Flags;
IsRawFile = value.Test(0);
IsEncrypted = value.Test(1);
LoadMethod = loadMethod;
Tags = tags;
}
/// <summary>
@@ -290,7 +290,6 @@ namespace YooAsset
// BundleList
foreach (var patchBundle in patchManifest.BundleList)
{
patchBundle.ParseFlagsValue();
patchBundle.ParseFileName(patchManifest.OutputNameStyle);
patchManifest.BundleDic.Add(patchBundle.BundleName, patchBundle);
}