static private byte[] HuffmanDecode(byte[] packed, int unpacked_size) { var dst = new byte[unpacked_size]; var decoder = new HuffmanDecoder(packed, dst); return(decoder.Unpack()); }
public override Stream OpenEntry(ArcFile arc, Entry entry) { var aent = entry as PackedEntry; if (null == aent || !aent.IsPacked) { return(base.OpenEntry(arc, entry)); } aent.UnpackedSize = arc.File.View.ReadUInt32(entry.Offset); var packed = arc.File.View.ReadBytes(entry.Offset + 4, entry.Size - 4); var unpacked = new byte[aent.UnpackedSize]; var decoder = new HuffmanDecoder(packed, unpacked); decoder.Unpack(); return(new BinMemoryStream(unpacked, entry.Name)); }
public override Stream OpenEntry(ArcFile arc, Entry entry) { var aent = entry as AosEntry; if (null == aent || !aent.IsCompressed) { return(base.OpenEntry(arc, entry)); } uint unpacked_size = arc.File.View.ReadUInt32(entry.Offset); var packed = new byte[entry.Size - 4]; arc.File.View.Read(entry.Offset + 4, packed, 0, (uint)packed.Length); var unpacked = new byte[unpacked_size]; var decoder = new HuffmanDecoder(packed, unpacked); decoder.Unpack(); return(new BinMemoryStream(unpacked, entry.Name)); }
internal static void DecompressHuffman(IBinaryStream input, byte[] output) { var decomp = new HuffmanDecoder(input); decomp.Unpack(output); }