ProjectSEncryption.cs 1003 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using YooAsset.Editor;
  6. public class EncryptionNone : IEncryptionServices
  7. {
  8. bool IEncryptionServices.Check(string bundleName)
  9. {
  10. return false;
  11. }
  12. byte[] IEncryptionServices.Encrypt(byte[] fileData)
  13. {
  14. throw new System.NotImplementedException();
  15. }
  16. }
  17. public class GameEncryption : IEncryptionServices
  18. {
  19. /// <summary>
  20. /// 检测资源包是否需要加密
  21. /// </summary>
  22. bool IEncryptionServices.Check(string bundleName)
  23. {
  24. // 对配置表进行加密
  25. return bundleName.Contains("Config");
  26. }
  27. /// <summary>
  28. /// 对数据进行加密,并返回加密后的数据
  29. /// </summary>
  30. byte[] IEncryptionServices.Encrypt(byte[] fileData)
  31. {
  32. int offset = 32;
  33. var temper = new byte[fileData.Length + offset];
  34. Buffer.BlockCopy(fileData, 0, temper, offset, fileData.Length);
  35. return temper;
  36. }
  37. }