use mf4_rs::api::mdf::Mdf;
use mf4_rs::block_layout::FileLayout;
use mf4_rs::error::MdfError;
fn main() -> Result<(), MdfError> {
let path = "example.mf4";
let layout = FileLayout::from_file(path)?;
let mdf = Mdf::from_file(path)?;
let _layout_via_mdf = mdf.file_layout()?;
println!("===== Flat listing =====");
println!("{}", layout.to_text());
println!("===== Link tree =====");
println!("{}", layout.to_tree());
layout.write_text_to_file("example.layout.txt")?;
layout.write_tree_to_file("example.layout.tree.txt")?;
layout.write_json_to_file("example.layout.json")?;
println!(
"Wrote example.layout.txt, example.layout.tree.txt, example.layout.json ({} blocks, {} gaps)",
layout.blocks.len(),
layout.gaps.len()
);
Ok(())
}