Beispiel #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);
        }
Beispiel #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;
                if (comp == CompressionType.LZWithHeader)
                {
                    data = ROM.LZ77_DecompressWithHeader(parentFile.getContents());
                }
                else
                {
                    data = ROM.LZ77_Decompress(parentFile.getContents());
                }
                Array.Copy(newFile, 0, data, start, newFile.Length);
                parentFile.replace(ROM.LZ77_Compress(data, comp == CompressionType.LZWithHeader), this);
            }
        }