mirror of https://github.com/tuyoogame/YooAsset
update sample
parent
70465a49d7
commit
7d21da76fb
|
@ -42,7 +42,8 @@ public class FileStreamEncryption : IEncryptionServices
|
||||||
{
|
{
|
||||||
public EncryptResult Encrypt(EncryptFileInfo fileInfo)
|
public EncryptResult Encrypt(EncryptFileInfo fileInfo)
|
||||||
{
|
{
|
||||||
if (fileInfo.BundleName.Contains("gameres_music"))
|
// LoadFromStream
|
||||||
|
if (fileInfo.BundleName.Contains("_gameres_audio"))
|
||||||
{
|
{
|
||||||
var fileData = File.ReadAllBytes(fileInfo.FilePath);
|
var fileData = File.ReadAllBytes(fileInfo.FilePath);
|
||||||
for (int i = 0; i < fileData.Length; i++)
|
for (int i = 0; i < fileData.Length; i++)
|
||||||
|
@ -55,7 +56,22 @@ public class FileStreamEncryption : IEncryptionServices
|
||||||
result.EncryptedData = fileData;
|
result.EncryptedData = fileData;
|
||||||
return result;
|
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();
|
EncryptResult result = new EncryptResult();
|
||||||
result.LoadMethod = EBundleLoadMethod.Normal;
|
result.LoadMethod = EBundleLoadMethod.Normal;
|
||||||
|
|
Loading…
Reference in New Issue