mirror of
https://github.com/xavo95/repak.git
synced 2025-01-18 19:04:07 +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() {
|
for ver in Version::iter() {
|
||||||
match Pak::read(&mut *reader, ver, key.as_ref()) {
|
match Pak::read(&mut *reader, ver, key.as_ref()) {
|
||||||
Ok(pak) => {
|
Ok(pak) => return Ok(Self { pak, key }),
|
||||||
return Ok(PakReader { pak, key });
|
Err(err) => writeln!(log, "trying version {} failed: {}", ver, err)?,
|
||||||
}
|
|
||||||
Err(err) => {
|
|
||||||
writeln!(log, "trying version {} failed: {}", ver, err)?;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(super::Error::UnsuportedOrEncrypted(log))
|
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 {
|
pub fn version(&self) -> super::Version {
|
||||||
self.pak.version
|
self.pak.version
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue