From 9e806861ec94ec107151fdd3f2e8cb263394561d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BD=95=E5=86=A0=E5=B3=B0?= <hevinci@hotmail.com>
Date: Wed, 12 Feb 2025 16:28:31 +0800
Subject: [PATCH] update extension sample

---
 .../Operation/TTFSLoadBundleOperation.cs                 | 2 +-
 .../TiktokFileSystem/TiktokFileSystem.cs                 | 9 +++++++--
 .../Operation/WXFSLoadBundleOperation.cs                 | 2 +-
 .../WechatFileSystem/WechatFileSystem.cs                 | 9 +++++++--
 4 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadBundleOperation.cs b/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadBundleOperation.cs
index 75f1af3e..470ba5a5 100644
--- a/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadBundleOperation.cs	
+++ b/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadBundleOperation.cs	
@@ -62,7 +62,7 @@ internal class TTFSLoadBundleOperation : FSLoadBundleOperation
                 AssetBundle assetBundle;
                 var downloadHanlder = _webRequest.downloadHandler as DownloadHandlerTTAssetBundle;
                 if (_bundle.Encrypted)
-                    assetBundle = _fileSystem.LoadEncryptedAssetBundle(downloadHanlder.data);
+                    assetBundle = _fileSystem.LoadEncryptedAssetBundle(_bundle, downloadHanlder.data);
                 else
                     assetBundle = downloadHanlder.assetBundle;
 
diff --git a/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/TiktokFileSystem/TiktokFileSystem.cs b/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/TiktokFileSystem/TiktokFileSystem.cs
index b936cb2c..31f87996 100644
--- a/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/TiktokFileSystem/TiktokFileSystem.cs	
+++ b/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/TiktokFileSystem/TiktokFileSystem.cs	
@@ -272,9 +272,14 @@ internal class TiktokFileSystem : IFileSystem
     /// <summary>
     /// 加载加密资源文件
     /// </summary>
-    public AssetBundle LoadEncryptedAssetBundle(byte[] fileData)
+    public AssetBundle LoadEncryptedAssetBundle(PackageBundle bundle, byte[] fileData)
     {
-        return DecryptionServices.LoadAssetBundle(fileData);
+        WebDecryptFileInfo fileInfo = new WebDecryptFileInfo();
+        fileInfo.BundleName = bundle.BundleName;
+        fileInfo.FileLoadCRC = bundle.UnityCRC;
+        fileInfo.FileData = fileData;
+        var decryptResult = DecryptionServices.LoadAssetBundle(fileInfo);
+        return decryptResult.Result;
     }
     #endregion
 }
diff --git a/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadBundleOperation.cs b/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadBundleOperation.cs
index 325d4403..1169c195 100644
--- a/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadBundleOperation.cs	
+++ b/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadBundleOperation.cs	
@@ -61,7 +61,7 @@ internal class WXFSLoadBundleOperation : FSLoadBundleOperation
                 AssetBundle assetBundle;
                 var downloadHanlder = _webRequest.downloadHandler as DownloadHandlerWXAssetBundle;
                 if (_bundle.Encrypted)
-                    assetBundle = _fileSystem.LoadEncryptedAssetBundle(downloadHanlder.data);
+                    assetBundle = _fileSystem.LoadEncryptedAssetBundle(_bundle, downloadHanlder.data);
                 else
                     assetBundle = downloadHanlder.assetBundle;
 
diff --git a/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs b/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs
index 645c7ef9..81a4dd6c 100644
--- a/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs	
+++ b/Assets/YooAsset/Samples~/Extension Sample/Runtime/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs	
@@ -290,9 +290,14 @@ internal class WechatFileSystem : IFileSystem
     /// <summary>
     /// 加载加密资源文件
     /// </summary>
-    public AssetBundle LoadEncryptedAssetBundle(byte[] fileData)
+    public AssetBundle LoadEncryptedAssetBundle(PackageBundle bundle, byte[] fileData)
     {
-        return DecryptionServices.LoadAssetBundle(fileData);
+        WebDecryptFileInfo fileInfo = new WebDecryptFileInfo();
+        fileInfo.BundleName = bundle.BundleName;
+        fileInfo.FileLoadCRC = bundle.UnityCRC;
+        fileInfo.FileData = fileData;
+        var decryptResult = DecryptionServices.LoadAssetBundle(fileInfo);
+        return decryptResult.Result;
     }
     #endregion
 }