You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using System;
|
|
|
|
namespace NetMFAPatcher.Utils
|
|
{
|
|
public static class Decompressor
|
|
{
|
|
public static byte[] Decompress(ByteIO exeReader)
|
|
{
|
|
Int32 decomp_size = exeReader.ReadInt32();
|
|
Int32 comp_size = exeReader.ReadInt32();
|
|
return decompress_block(exeReader, comp_size, decomp_size);
|
|
|
|
}
|
|
public static ByteIO DecompressAsReader(ByteIO exeReader)
|
|
{
|
|
Int32 decomp_size = exeReader.ReadInt32();
|
|
Int32 comp_size = exeReader.ReadInt32();
|
|
byte[] compressedData = exeReader.ReadBytes(comp_size);
|
|
byte[] actualData = Ionic.Zlib.ZlibStream.UncompressBuffer(compressedData);
|
|
return new ByteIO(actualData);
|
|
}
|
|
public static byte[] decompress_block(ByteIO reader,int size,int decomp_size)
|
|
{
|
|
byte[] compressedData = reader.ReadBytes(size);
|
|
byte[] actualData = Ionic.Zlib.ZlibStream.UncompressBuffer(compressedData);
|
|
return actualData;
|
|
|
|
}
|
|
|
|
public static ByteIO decompress_asReader(ByteIO image_data, int v, int decompressed_size)
|
|
{
|
|
return new ByteIO(decompress_block(image_data, v, decompressed_size));
|
|
}
|
|
}
|
|
|
|
|
|
}
|