示例#1
0
        internal static void SaveRom(RomManager rommgr)
        {
            if (rommgr is object)
            {
                bool dontpatchupdates;
                RomWatcher.EnableRaisingEvents = false;
                if (rommgr.AreRomUpdatesAvaiable())
                {
                    var switchExpr = Settings.General.ActionIfUpdatePatches;
                    switch (switchExpr)
                    {
                    case DialogResult.Yes:
                        dontpatchupdates = false;
                        break;

                    case DialogResult.No:
                        dontpatchupdates = true;
                        break;

                    default:
                        var tdi = new TaskDialogInfo(Form_Main_Resources.MsgBox_UpdatePatchesAvaiable_Title, eTaskDialogIcon.ShieldHelp, Form_Main_Resources.MsgBox_UpdatePatchesAvaiable_Title, Form_Main_Resources.MsgBox_UpdatePatchesAvaiable, eTaskDialogButton.Yes | eTaskDialogButton.No | eTaskDialogButton.Cancel);
                        tdi.CheckBoxCommand = new Command()
                        {
                            Text = "Don't show this message again."
                        };

                        var switchExpr1 = TaskDialog.Show(tdi);
                        switch (switchExpr1)
                        {
                        case eTaskDialogResult.Yes:
                            dontpatchupdates = false;
                            if (tdi.CheckBoxCommand.Checked)
                            {
                                Settings.General.ActionIfUpdatePatches = DialogResult.Yes;
                            }

                            break;

                        case eTaskDialogResult.No:
                            dontpatchupdates = true;
                            if (tdi.CheckBoxCommand.Checked)
                            {
                                Settings.General.ActionIfUpdatePatches = DialogResult.No;
                            }

                            break;

                        default:
                            return;
                        }

                        if (!tdi.CheckBoxCommand.Checked)
                        {
                            Settings.General.ActionIfUpdatePatches = DialogResult.None;
                        }

                        break;
                    }
                }
                else
                {
                    dontpatchupdates = false;
                }

                rommgr.SaveRom(
                    DontPatchUpdates: dontpatchupdates,
                    recalcChecksumBehavior: Settings.General.RecalcChecksumBehavior);
                RomWatcher.EnableRaisingEvents = true;
            }
        }