Read simple XML in

This commit is contained in:
Björn Gaier 2022-11-04 09:28:32 +01:00
parent 6d8e99841e
commit 5a8c7fb56c
5 changed files with 27 additions and 3 deletions

View File

@ -0,0 +1,13 @@
<ISO_Project>
<Description>
<Publisher>Jaby Wuff</Publisher>
<License>C:/../</License>
</Description>
<Track type="data">
<File name="Miau.png">C:/../</File>
<Audiofile>C:/../</Audiofile>
<Directory name="Wuff">
<File name="Miau.png" type="file">C:/../</File>
</Directory>
</Track>
</ISO_Project>

View File

@ -0,0 +1,5 @@
mod xml;
pub fn parse_xml(xml: String) {
println!("Wuff: {}", xml);
}

View File

@ -1,3 +1,4 @@
pub mod config_reader;
pub mod encoder;
pub mod file_writer;
pub mod types;

View File

@ -1,4 +1,4 @@
use psxcdgen_ex::{encoder::psx::{calculate_psx_lbas, encode_psx_image}, file_writer::{ImageType, write_image}, types::{layout::Layout, CDDesc, File, Directory}};
use psxcdgen_ex::{encoder::psx::{calculate_psx_lbas, encode_psx_image}, file_writer::{ImageType, write_image}, types::{layout::Layout, CDDesc, File, Directory}, config_reader};
use std::{path::PathBuf, str::FromStr};
use tool_helper::Error;
@ -58,9 +58,14 @@ fn run_main() -> Result<(), Error> {
write_image(desc, encode_psx_image, ImageType::BinCue, PathBuf::from_str("planschi.bin")?)
}
fn run_main_xml() -> Result<(), Error> {
config_reader::parse_xml(std::fs::read_to_string("../Tests/ISO_Planschbecken.xml")?);
Ok(())
}
fn main() {
match run_main() {
Ok(_) => println!("\n<== Planschbecken ==>"),
match run_main_xml() {
Ok(_) => println!("\n<== Planschbecken End ==>"),
Err(error) => println!("{}", error)
}
}