Exemple #1
0
        static private byte[] HuffmanDecode(byte[] packed, int unpacked_size)
        {
            var dst     = new byte[unpacked_size];
            var decoder = new HuffmanDecoder(packed, dst);

            return(decoder.Unpack());
        }
Exemple #2
0
        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));
        }
Exemple #3
0
        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));
        }
Exemple #4
0
        internal static void DecompressHuffman(IBinaryStream input, byte[] output)
        {
            var decomp = new HuffmanDecoder(input);

            decomp.Unpack(output);
        }