mirror of
https://github.com/xavo95/repak.git
synced 2025-01-19 03:09:12 +00:00
26 lines
686 B
Rust
26 lines
686 B
Rust
mod list;
|
|
mod unpack;
|
|
mod version;
|
|
pub use {list::list, unpack::unpack, version::version};
|
|
|
|
fn load_pak(
|
|
path: String,
|
|
key: String,
|
|
) -> Result<unpak::Pak<std::io::BufReader<std::fs::File>>, unpak::Error> {
|
|
for ver in unpak::Version::iter() {
|
|
match unpak::Pak::new(
|
|
std::io::BufReader::new(std::fs::OpenOptions::new().read(true).open(&path)?),
|
|
ver,
|
|
match key.as_bytes() {
|
|
&[] => None,
|
|
key => Some(key),
|
|
},
|
|
) {
|
|
Ok(pak) => {
|
|
return Ok(pak);
|
|
}
|
|
_ => continue,
|
|
}
|
|
}
|
|
Err(unpak::Error::Other("version unsupported"))
|
|
}
|