Exemple #1
0
        public CompressedFile(File parent, CompressionType ct)
        {
            nameP      = parent.name;
            parentFile = parent;
            comp       = ct;

            if (comp == CompressionType.MaybeCompressed)
            {
                comp = parent.guessCompression(false);
            }

            if (comp == CompressionType.None)
            {
                fileSizeP = parent.fileSize;
            }
            else if (comp == CompressionType.LZ)
            {
                fileSizeP = ROM.LZ77_GetDecompressedSize(parent.getInterval(0, 4), false);
            }
            else if (comp == CompressionType.LZWithHeader)
            {
                fileSizeP = ROM.LZ77_GetDecompressedSize(parent.getInterval(0, 8), true);
            }
            else if (comp == CompressionType.Yaz0)
            {
                fileSizeP = ROM.Yaz0_Decompress(parent.getContents()).Length;
            }
        }
Exemple #2
0
        public override byte[] getInterval(int start, int end)
        {
            if (comp == CompressionType.None)
            {
                return(parentFile.getInterval(start, end));
            }

            byte[] data = parentFile.getContents();
            if (comp == CompressionType.LZ)
            {
                data = ROM.LZ77_Decompress(parentFile.getContents(), false);
            }
            else if (comp == CompressionType.LZWithHeader)
            {
                data = ROM.LZ77_Decompress(parentFile.getContents(), true);
            }
            else if (comp == CompressionType.Yaz0)
            {
                data = ROM.Yaz0_Decompress(parentFile.getContents());
            }

            int len = end - start;

            byte[] thisdata = new byte[len];
            Array.Copy(data, start, thisdata, 0, len);
            return(thisdata);
        }
Exemple #3
0
 public override byte[] getContents()
 {
     return(parentFile.getInterval(inlineOffs, inlineOffs + inlineLen));
 }