예제 #1
0
        // Closing ROM
        private void FinalizeAndSave(FormClosingEventArgs e, int assembleFlag)
        {
            DialogResult result;

            if (e != null && AppControl.WriteToROMAndCloseWindows())
            {
                e.Cancel = true;
                return;
            }
            if (!AppControl.VerifyMD5Checksum())
            {
                result = MessageBox.Show(
                    "There are changes to the rom that have not been saved.\n\n" +
                    "Would you like to save them now" + (assembleFlag == 1 ? " and quit?" : "?"), "Lazy Shell",
                    MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
                {
                    if (!AppControl.SaveRomFile())
                    {
                        MessageBox.Show(
                            "There was an error saving to \"" + Model.FileName + "\"",
                            "Lazy Shell", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                if (result == DialogResult.Cancel)
                {
                    if (e != null)
                    {
                        e.Cancel = true;
                    }
                    cancelAnotherLoad = true;
                    AppControl.WriteToROM();
                    return;
                }
                else
                {
                    cancelAnotherLoad = false;
                }
            }
            if (e != null)
            {
                this.Dispose();
                Application.Exit();
            }
        }