mirror of
https://github.com/xavo95/repak.git
synced 2025-01-18 10:54:38 +00:00
add method for known versions
This commit is contained in:
parent
b1a8281551
commit
03dd3a63ed
1 changed files with 10 additions and 7 deletions
|
@ -92,18 +92,21 @@ impl PakReader {
|
|||
|
||||
for ver in Version::iter() {
|
||||
match Pak::read(&mut *reader, ver, key.as_ref()) {
|
||||
Ok(pak) => {
|
||||
return Ok(PakReader { pak, key });
|
||||
}
|
||||
Err(err) => {
|
||||
writeln!(log, "trying version {} failed: {}", ver, err)?;
|
||||
continue;
|
||||
}
|
||||
Ok(pak) => return Ok(Self { pak, key }),
|
||||
Err(err) => writeln!(log, "trying version {} failed: {}", ver, err)?,
|
||||
}
|
||||
}
|
||||
Err(super::Error::UnsuportedOrEncrypted(log))
|
||||
}
|
||||
|
||||
pub fn new<R: Read + Seek>(
|
||||
reader: &mut R,
|
||||
version: super::Version,
|
||||
key: Option<aes::Aes256>,
|
||||
) -> Result<Self, super::Error> {
|
||||
Pak::read(reader, version, key.as_ref()).map(|pak| Self { pak, key })
|
||||
}
|
||||
|
||||
pub fn version(&self) -> super::Version {
|
||||
self.pak.version
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue