Esempio n. 1
0
        public override void replace(byte[] newFile, object editor)
        {
            if (!isAGoodEditor(editor))
            {
                throw new Exception("NOT CORRECT EDITOR " + name);
            }
            if (newFile.Length != inlineLen)
            {
                throw new Exception("Trying to resize an InlineFile: " + name);
            }

            parentFile.replaceInterval(newFile, inlineOffs);
        }
Esempio n. 2
0
        public override void replaceInterval(byte[] newFile, int start)
        {
            validateInterval(start, start + newFile.Length);

            if (comp == CompressionType.None)
            {
                parentFile.replaceInterval(newFile, start);
            }
            else
            {
                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());
                }

                Array.Copy(newFile, 0, data, start, newFile.Length);
                parentFile.replace(ROM.LZ77_Compress(data, comp == CompressionType.LZWithHeader), this);
            }
        }