/// <summary> /// 加密ab资源 /// </summary> /// <param name="abPath">Ab path.</param> /// <param name="manifest">Manifest.</param> private static void DoEncryptAssetBundle(string encryptPath, string abPath, AssetBundleManifest manifest) { // CopyDirectory FileMgr.CopyDirectory(abPath, encryptPath); // 遍历该文件下的所有AssetBundles foreach (string abName in manifest.GetAllAssetBundles()) { // 目前只是etc需要加密 if (!string.Equals(abName, "etc")) { continue; } // 读取文件 byte[] abBytes = File.ReadAllBytes(string.Format("{0}/{1}", abPath, abName)); // 加密资源 byte[] encyptBytes = ResourceMgr.Instance.Encypt(abBytes); // 重新输入文件 File.WriteAllBytes(string.Format("{0}/{1}", encryptPath, abName), encyptBytes); } }