Beispiel #1
0
        private void EntryDelete_Click(object sender, EventArgs e)
        {
            //revert the changes to this chunk, similar to main window but actually all the way to originaldata
            //we do this by removing the selected patch entry, then reloading the iff.
            if (ActiveItem == null || ActivePIFF == null || ActivePIFFChunk == null)
            {
                return;
            }
            var result = MessageBox.Show("Deleting a PIFF entry will revert all changes to that chunk, " +
                                         "but will also reset any unsaved changes you've made to the IFF. This action cannot be reversed, " +
                                         "as it immediately saves the PIFF. Are you sure you want to do this?",
                                         "Deleting PIFF Entry", MessageBoxButtons.YesNo);

            if (result == DialogResult.No)
            {
                return;
            }

            //remove the current entry
            var entries = ActivePIFFChunk.Entries.ToList();

            entries.Remove(ActiveItem.Entry);
            ActivePIFFChunk.Entries = entries.ToArray();
            if (ActiveItem.Entry.EntryType == PIFFEntryType.Add)
            {
                ActiveIff.RemoveChunk(ActiveItem.Replaced);
            }

            var changes = Content.Content.Get().Changes;

            changes.DiscardChange(ActiveIff);
            RegisterChange();
            //changes.SaveChange(ActiveIff);
            Render();
        }