feat: implement production cas v1

This commit is contained in:
2026-06-28 12:39:17 +08:00
parent dd53e3054e
commit b202d7b231
33 changed files with 1082 additions and 447 deletions
+9 -7
View File
@@ -65,14 +65,13 @@ impl ManifestDriver for AddressablesCatalogDriver {
async fn parse(&self, raw_data: &[u8]) -> Result<GenericManifest, String> {
// 解析 JSON
let text = std::str::from_utf8(raw_data)
.map_err(|e| format!("Invalid UTF-8: {}", e))?;
let text = std::str::from_utf8(raw_data).map_err(|e| format!("Invalid UTF-8: {}", e))?;
let json: Value = serde_json::from_str(text)
.map_err(|e| format!("Invalid JSON: {}", e))?;
let json: Value = serde_json::from_str(text).map_err(|e| format!("Invalid JSON: {}", e))?;
// 提取元数据
let locator_id = json.get("m_LocatorId")
let locator_id = json
.get("m_LocatorId")
.and_then(|v| v.as_str())
.map(|s| s.to_string());
@@ -108,7 +107,7 @@ impl ManifestDriver for AddressablesCatalogDriver {
resources.push(ResourceEntry {
path: path.to_string(),
hash: format!("addressable_{}", index), // 临时 Hash
size: 0, // 大小未知
size: 0, // 大小未知
resource_type,
});
}
@@ -180,6 +179,9 @@ mod tests {
let manifest = result.unwrap();
assert_eq!(manifest.format, ManifestFormat::AddressablesCatalog);
assert_eq!(manifest.resources.len(), 3);
assert_eq!(manifest.resources[0].resource_type, ResourceType::AssetBundle);
assert_eq!(
manifest.resources[0].resource_type,
ResourceType::AssetBundle
);
}
}