Exemplo n.º 1
0
        public virtual void saveOffsets()
        {
            if (beginFile != null)
            {
                beginFile.setUintAt(beginOffset, (uint)(fileBegin - filesystemDataOffset));
            }

            if (endFile != null)
            {
                if (endIsSize)
                {
                    endFile.setUintAt(endOffset, (uint)fileSize);
                }
                else
                {
                    endFile.setUintAt(endOffset, (uint)(fileBegin + fileSize - filesystemDataOffset));
                }
            }
        }
Exemplo n.º 2
0
        private void compressWithHeaderButton_Click(object sender, EventArgs e)
        {
            File f = fileTreeView.SelectedNode.Tag as File;

            try
            {
                f.beginEdit(this);
            }
            catch (AlreadyEditingException)
            {
                MessageBox.Show(LanguageManager.Get("Errors", "File"));
                return;
            }

            byte[] RawFile  = f.getContents();
            byte[] CompFile = ROM.LZ77_Compress(RawFile);

            byte[] CompFileWithHeader = new byte[CompFile.Length + 4];
            Array.Copy(CompFile, 0, CompFileWithHeader, 4, CompFile.Length);
            f.replace(CompFileWithHeader, this);
            f.setUintAt(0, 0x37375A4C);
            UpdateFileInfo();
            f.endEdit(this);
        }