mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-07-23 07:55:15 +08:00
feat: implement production cas v1
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user