list_music/list_music.rs
1use anyhow::Result;
2use regnumassets::{AssetType, ResourceIndex};
3use std::fs::File;
4
5fn main() -> Result<()> {
6 let f = File::open("examples/regnum/data2.idx")?;
7 let index = ResourceIndex::read(f).unwrap();
8
9 let sounds = index.filter_by_type(AssetType::Music);
10
11 for sound in &sounds {
12 println!(
13 "Resource #{}: {}",
14 sound.resource_id.unwrap_or(0),
15 sound.name.as_deref().unwrap_or("(unnamed)".into())
16 );
17 }
18
19 Ok(())
20}