{"id":28042285,"url":"https://github.com/lhx077/abprocessor","last_synced_at":"2026-04-29T00:31:32.344Z","repository":{"id":291616901,"uuid":"976243268","full_name":"lhx077/ABProcessor","owner":"lhx077","description":"Unity AssetBundle Processor","archived":false,"fork":false,"pushed_at":"2025-05-05T17:31:35.000Z","size":48,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-05T17:46:35.571Z","etag":null,"topics":["assetbundle","game-development","modding","modding-tools","unity","unity3d"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lhx077.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-01T18:56:17.000Z","updated_at":"2025-05-05T17:31:39.000Z","dependencies_parsed_at":"2025-05-05T17:46:55.280Z","dependency_job_id":"954a17f5-c43a-47c9-92b3-623983c69f26","html_url":"https://github.com/lhx077/ABProcessor","commit_stats":null,"previous_names":["lhx077/abprocessor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lhx077%2FABProcessor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lhx077%2FABProcessor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lhx077%2FABProcessor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lhx077%2FABProcessor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lhx077","download_url":"https://codeload.github.com/lhx077/ABProcessor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253578452,"owners_count":21930552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assetbundle","game-development","modding","modding-tools","unity","unity3d"],"created_at":"2025-05-11T14:25:19.751Z","updated_at":"2026-04-29T00:31:32.338Z","avatar_url":"https://github.com/lhx077.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ABProcessor - Unity AssetBundle外部处理库\n\n[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/lhx077/ABProcessor)\n\n![Alt](https://repobeats.axiom.co/api/embed/6d91261460c5ad6d0889b6bd1e55d2948dca2f9f.svg \"Repobeats analytics image\")\n\n[![Star History Chart](https://api.star-history.com/svg?repos=lhx077/ABProcessor\u0026type=Date)](https://www.star-history.com/#lhx077/ABProcessor\u0026Date)\n\n## 项目概述\n\nABProcessor是一个用C#编写的库，用于在Unity外部处理AssetBundle(.ab)文件。该库提供了创建、压缩、加密和管理AssetBundle的功能，可以轻松集成到现有项目中。对于性能要求高的场景，ABProcessor还提供了C++原生方法支持，通过P/Invoke与C#交互。\n\n该库完全符合Unity AssetBundle格式规范，生成的文件可以直接在Unity中加载使用。无论是游戏开发、资源管理还是自动化工具开发，ABProcessor都能提供高效可靠的AssetBundle处理能力。\n\n## 功能特性\n\n- **AssetBundle创建**：将多个文件打包成AssetBundle格式\n- **压缩支持**：支持None、LZMA、LZ4和LZ4HC多种压缩方式\n- **加密功能**：支持对AssetBundle内容进行AES加密保护\n- **高性能处理**：可选的C++原生方法提高处理性能\n- **跨平台支持**：基于.NET Standard 2.0，可在多种平台使用\n- **简洁API**：提供简单易用的API接口\n\n## 项目结构\n\n```\nABProcessor/\n├── src/                    # 源代码目录\n│   ├── ABProcessor.cs      # 核心处理类\n│   ├── ABProcessorNative.cs # C#与C++交互的包装类\n│   └── Native/             # C++原生代码\n│       └── ABProcessorNative.cpp # 高性能处理的C++实现\n├── samples/                # 示例代码\n│   ├── ABProcessorSample.cs # 示例程序\n│   └── ABProcessorSample.csproj # 示例项目文件\n└── ABProcessor.csproj      # 主项目文件\n```\n\n## 快速开始\n\n### 安装\n\n1. 克隆仓库到本地：\n   ```\n   git clone https://github.com/lhx077/ABProcessor.git\n   ```\n\n2. 使用Visual Studio或其他IDE打开解决方案文件 `ABProcessor.sln`\n\n3. 编译项目：\n   ```\n   dotnet build\n   ```\n\n### 基本用法\n\n#### 创建AssetBundle\n\n```csharp\n// 初始化处理器\nAssetBundleProcessor processor = new AssetBundleProcessor(\n    outputPath: \"D:/Output\",\n    compressionLevel: System.IO.Compression.CompressionLevel.Optimal,\n    useEncryption: false,\n    unityCompressionType: UnityCompressionType.LZ4,\n    unityVersion: \"2019.4.0f1\"\n);\n\n// 准备文件列表\nList\u003cstring\u003e files = new List\u003cstring\u003e\n{\n    \"D:/Assets/Texture1.png\",\n    \"D:/Assets/Model1.fbx\",\n    \"D:/Assets/Config.json\"\n};\n\n// 创建AssetBundle\nstring bundlePath = processor.CreateAssetBundle(\"my_bundle\", files);\nConsole.WriteLine($\"AssetBundle已创建: {bundlePath}\");\n```\n\n#### 解包AssetBundle\n\n```csharp\n// 初始化处理器\nAssetBundleProcessor processor = new AssetBundleProcessor(\"D:/Extract\");\n\n// 解包AssetBundle\nList\u003cstring\u003e extractedFiles = processor.ExtractAssetBundle(\n    \"D:/Bundles/my_bundle\", \n    \"D:/Extract\"\n);\n\nConsole.WriteLine($\"已解包 {extractedFiles.Count} 个文件\");\n```\n\n#### 使用加密\n\n```csharp\n// 初始化处理器（启用加密）\nAssetBundleProcessor processor = new AssetBundleProcessor(\n    outputPath: \"D:/Output\",\n    useEncryption: true,\n    encryptionKey: \"your_secret_key_here\"\n);\n\n// 创建加密的AssetBundle\nstring bundlePath = processor.CreateAssetBundle(\"encrypted_bundle\", files);\n\n// 解包加密的AssetBundle（需要提供相同的密钥）\nList\u003cstring\u003e extractedFiles = processor.ExtractAssetBundle(\n    bundlePath, \n    \"D:/Extract\"\n);\n```\n\n## 高级用法\n\n### 使用不同的压缩类型\n\n```csharp\n// 使用LZMA压缩（更高压缩率，但解压较慢）\nAssetBundleProcessor lzmaProcessor = new AssetBundleProcessor(\n    outputPath: \"D:/Output\",\n    unityCompressionType: UnityCompressionType.LZMA\n);\n\n// 使用LZ4HC压缩（高压缩率的LZ4变种）\nAssetBundleProcessor lz4hcProcessor = new AssetBundleProcessor(\n    outputPath: \"D:/Output\",\n    unityCompressionType: UnityCompressionType.LZ4HC\n);\n\n// 不使用压缩（更快的加载速度，但文件更大）\nAssetBundleProcessor noCompressionProcessor = new AssetBundleProcessor(\n    outputPath: \"D:/Output\",\n    unityCompressionType: UnityCompressionType.None\n);\n```\n\n### 使用C++高性能版本\n\n```csharp\n// 创建C++版本的处理器\nusing (ABProcessorNative processor = new ABProcessorNative(\n    outputPath: \"D:/Output\",\n    compressionLevel: System.IO.Compression.CompressionLevel.Optimal,\n    useEncryption: false,\n    encryptionKey: null,\n    compressionType: UnityCompressionType.LZ4,\n    unityVersion: \"2019.4.0f1\"))\n{\n    // 创建AssetBundle\n    List\u003cstring\u003e files = new List\u003cstring\u003e\n    {\n        \"D:/Assets/Texture1.png\",\n        \"D:/Assets/Model1.fbx\",\n        \"D:/Assets/Config.json\"\n    };\n    \n    string bundlePath = processor.CreateAssetBundle(\"my_bundle\", files);\n    Console.WriteLine($\"AssetBundle已创建: {bundlePath}\");\n    \n    // 解包AssetBundle\n    List\u003cstring\u003e extractedFiles = processor.ExtractAssetBundle(\n        bundlePath, \n        \"D:/Extract\"\n    );\n    \n    Console.WriteLine($\"已解包 {extractedFiles.Count} 个文件\");\n}\n```\n\n## 编译C++原生库\n\n### Windows\n\n1. 使用Visual Studio打开解决方案\n2. 右键点击Native项目，选择\"生成\"\n3. 编译后的DLL将位于 `bin/Debug/netstandard2.0/` 目录下\n\n### Linux/macOS\n\n```bash\n# 安装必要的工具\nsudo apt-get install build-essential cmake\n\n# 编译原生库\ncd ABProcessor/src/Native\ncmake .\nmake\n\n# 复制库文件到输出目录\ncp libABProcessorNative.so ../../bin/Debug/netstandard2.0/\n```\n\n## 注意事项\n\n- 该库不依赖Unity，可以在任何支持.NET Standard 2.0的环境中使用\n- 使用C++原生方法需要编译对应平台的原生库\n- 加密功能使用AES算法，请妥善保管密钥\n- 生成的AssetBundle文件与Unity完全兼容，可以直接在Unity中加载\n\n## 许可证\n\n本项目采用Apache 2.0许可证。详情请参阅LICENSE文件。\n\n## 贡献\n\n欢迎提交问题和拉取请求。对于重大更改，请先开issue讨论您想要更改的内容。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flhx077%2Fabprocessor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flhx077%2Fabprocessor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flhx077%2Fabprocessor/lists"}