mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-07-22 03:35:16 +08:00
Add the production-facing official update service and bat-official-sync watch CLI for unattended resource synchronization. Support launcher-resource discovery without installing the launcher, remote marker snapshots, local manifest audit and repair, official seed hash validation, bootstrap caching, richer Addressables coverage, SQLite resource persistence, and FFI JSON helpers.
60 lines
2.3 KiB
Rust
60 lines
2.3 KiB
Rust
use bat_adapters::manifest::ManifestDriver;
|
|
use bat_adapters::manifest::{AddressablesCatalogDriver, ManifestDriverRegistry};
|
|
|
|
#[tokio::main]
|
|
async fn main() -> anyhow::Result<()> {
|
|
println!("🎮 BlueArchiveToolkit - Addressables 解析演示");
|
|
println!("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
|
|
|
|
// 创建 Driver
|
|
let driver = AddressablesCatalogDriver::new();
|
|
println!("✅ Driver: {}", driver.name());
|
|
|
|
// 合成 Addressables Catalog,仅用于演示解析接口。
|
|
println!("\n📦 解析 Addressables Catalog...");
|
|
let catalog_json = r#"{
|
|
"m_LocatorId": "AddressablesMainContentCatalog",
|
|
"m_InternalIdPrefixes": ["https://synthetic.invalid/"],
|
|
"m_InternalIds": [
|
|
"synthetic/model.bundle",
|
|
"synthetic/texture.bundle",
|
|
"synthetic/ui-atlas.bundle",
|
|
"synthetic/table-manifest.json"
|
|
]
|
|
}"#;
|
|
|
|
if driver.can_parse(catalog_json.as_bytes()) {
|
|
println!(" ✅ 可以解析此 Catalog");
|
|
|
|
let manifest = driver.parse(catalog_json.as_bytes()).await?;
|
|
println!(" 解析结果:");
|
|
println!(" Locator ID: {:?}", manifest.metadata.locator_id);
|
|
println!(" 资源数量: {}", manifest.resources.len());
|
|
println!(" 资源列表:");
|
|
for (i, resource) in manifest.resources.iter().enumerate() {
|
|
println!(
|
|
" {}. {} ({}, address={:?}, deps={})",
|
|
i + 1,
|
|
resource.path,
|
|
resource.resource_type,
|
|
resource.address,
|
|
resource.dependencies.len()
|
|
);
|
|
}
|
|
}
|
|
|
|
// 测试 Registry
|
|
println!("\n🔄 测试 Driver Registry...");
|
|
let registry = ManifestDriverRegistry::with_defaults();
|
|
println!(" 注册的 Driver 数量: {}", registry.count());
|
|
|
|
let manifest = registry.parse(catalog_json.as_bytes()).await?;
|
|
println!(" ✅ Registry 自动解析成功");
|
|
println!(" 解析了 {} 个资源", manifest.resources.len());
|
|
|
|
println!("\n✅ 演示完成!");
|
|
println!("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
|
|
|
|
Ok(())
|
|
}
|