update sample

pull/62/head^2
hevinci 2023-02-20 15:54:22 +08:00
parent 70465a49d7
commit 7d21da76fb
1 changed files with 18 additions and 2 deletions

View File

@ -42,7 +42,8 @@ public class FileStreamEncryption : IEncryptionServices
{
public EncryptResult Encrypt(EncryptFileInfo fileInfo)
{
if (fileInfo.BundleName.Contains("gameres_music"))
// LoadFromStream
if (fileInfo.BundleName.Contains("_gameres_audio"))
{
var fileData = File.ReadAllBytes(fileInfo.FilePath);
for (int i = 0; i < fileData.Length; i++)
@ -55,7 +56,22 @@ public class FileStreamEncryption : IEncryptionServices
result.EncryptedData = fileData;
return result;
}
else
// LoadFromFileOffset
if (fileInfo.BundleName.Contains("_gameres_uiimage"))
{
var fileData = File.ReadAllBytes(fileInfo.FilePath);
int offset = 32;
var temper = new byte[fileData.Length + offset];
Buffer.BlockCopy(fileData, 0, temper, offset, fileData.Length);
EncryptResult result = new EncryptResult();
result.LoadMethod = EBundleLoadMethod.LoadFromFileOffset;
result.EncryptedData = temper;
return result;
}
// Normal
{
EncryptResult result = new EncryptResult();
result.LoadMethod = EBundleLoadMethod.Normal;