mirror of
https://github.com/xavo95/repak.git
synced 2025-01-18 10:54:38 +00:00
HOLY CRAP IT'S FINALLY WORKING!!!
This commit is contained in:
parent
b20a04c907
commit
f2f7d93fe2
1 changed files with 15 additions and 11 deletions
26
src/entry.rs
26
src/entry.rs
|
@ -92,12 +92,11 @@ impl Entry {
|
|||
use io::Write;
|
||||
match self.compression {
|
||||
Compression::None => buf.write_all(&data)?,
|
||||
Compression::Zlib => {
|
||||
let mut decoder = flate2::write::ZlibDecoder::new(buf);
|
||||
match &self.blocks {
|
||||
Some(blocks) => {
|
||||
for block in blocks {
|
||||
decoder.write(
|
||||
Compression::Zlib => match &self.blocks {
|
||||
Some(blocks) => {
|
||||
for block in blocks {
|
||||
io::copy(
|
||||
&mut flate2::read::ZlibDecoder::new(
|
||||
&data[match version >= Version::RelativeChunkOffsets {
|
||||
true => block.start as usize..block.end as usize,
|
||||
false => {
|
||||
|
@ -105,13 +104,18 @@ impl Entry {
|
|||
..(block.end - data_offset) as usize
|
||||
}
|
||||
}],
|
||||
)?;
|
||||
}
|
||||
),
|
||||
&mut buf,
|
||||
)?;
|
||||
}
|
||||
None => decoder.write_all(&data)?,
|
||||
}
|
||||
buf = decoder.finish()?;
|
||||
}
|
||||
None => {
|
||||
io::copy(
|
||||
&mut flate2::read::ZlibDecoder::new(data.as_slice()),
|
||||
&mut buf,
|
||||
)?;
|
||||
}
|
||||
},
|
||||
Compression::Gzip => todo!(),
|
||||
Compression::Oodle => todo!(),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue