mirror of
https://github.com/xavo95/repak.git
synced 2025-01-18 19:04:07 +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;
|
use io::Write;
|
||||||
match self.compression {
|
match self.compression {
|
||||||
Compression::None => buf.write_all(&data)?,
|
Compression::None => buf.write_all(&data)?,
|
||||||
Compression::Zlib => {
|
Compression::Zlib => match &self.blocks {
|
||||||
let mut decoder = flate2::write::ZlibDecoder::new(buf);
|
Some(blocks) => {
|
||||||
match &self.blocks {
|
for block in blocks {
|
||||||
Some(blocks) => {
|
io::copy(
|
||||||
for block in blocks {
|
&mut flate2::read::ZlibDecoder::new(
|
||||||
decoder.write(
|
|
||||||
&data[match version >= Version::RelativeChunkOffsets {
|
&data[match version >= Version::RelativeChunkOffsets {
|
||||||
true => block.start as usize..block.end as usize,
|
true => block.start as usize..block.end as usize,
|
||||||
false => {
|
false => {
|
||||||
|
@ -105,13 +104,18 @@ impl Entry {
|
||||||
..(block.end - data_offset) as usize
|
..(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::Gzip => todo!(),
|
||||||
Compression::Oodle => todo!(),
|
Compression::Oodle => todo!(),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue