示例#1
0
        private bool HandleMetaError(IGameFile localFile)
        {
            MessageCheckBox errorForm = new MessageCheckBox("Meta",
                                                            string.Format("Failed to find {0} from the id games mirror.\n\nIf you are sure this file should exist try changing your mirror in the Settings menu.", localFile.FileNameNoPath),
                                                            "Don't show this error again", SystemIcons.Error);

            errorForm.StartPosition = FormStartPosition.CenterParent;
            errorForm.ShowDialog(this);
            return(!errorForm.Checked);
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            MessageCheckBox messageBox = new MessageCheckBox("Confirm", GetDeleteConfirm(), "Delete save games, demos, and statistics associated with this port",
                                                             SystemIcons.Exclamation, MessageBoxButtons.OKCancel);

            messageBox.SetShowCheckBox(m_launchType == SourcePortLaunchType.SourcePort);

            if (SelectedItem != null && messageBox.ShowDialog(this) == DialogResult.OK)
            {
                int index = dgvSourcePorts.SelectedRows[0].Index;
                try
                {
                    if (m_launchType == SourcePortLaunchType.SourcePort)
                    {
                        m_adapter.UpdateGameFiles(GameFileFieldType.SourcePortID, GameFileFieldType.SourcePortID, SelectedItem.SourcePortID, null);

                        if (messageBox.Checked)
                        {
                            DeleteSourcePortFiles();
                        }
                        else
                        {
                            UnlinkFilesFromSourcePort();
                        }
                    }

                    m_adapter.DeleteSourcePort(SelectedItem);
                }
                catch (IOException)
                {
                    MessageBox.Show(this, "This file appears to be in use and cannot be deleted.", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (Exception ex)
                {
                    Util.DisplayUnexpectedException(this, ex);
                }

                ResetData();

                if (index >= dgvSourcePorts.Rows.Count)
                {
                    index = dgvSourcePorts.Rows.Count - 1;
                }

                if (dgvSourcePorts.Rows.Count > 0)
                {
                    dgvSourcePorts.Rows[index].Selected = true;
                }
            }
        }
示例#3
0
        private GameFilePlayAdapter CreatePlayAdapter(PlayForm form, EventHandler processExited, AppConfiguration appConfig)
        {
            GameFilePlayAdapter playAdapter = new GameFilePlayAdapter();

            playAdapter.IWad            = form.SelectedIWad;
            playAdapter.Map             = form.SelectedMap;
            playAdapter.Skill           = form.SelectedSkill;
            playAdapter.Record          = form.Record;
            playAdapter.SpecificFiles   = form.SpecificFiles;
            playAdapter.AdditionalFiles = form.GetAdditionalFiles().ToArray();
            playAdapter.PlayDemo        = form.PlayDemo;
            playAdapter.ExtraParameters = form.ExtraParameters;
            playAdapter.SaveStatistics  = form.SaveStatistics;

            if (form.LoadLatestSave)
            {
                if (!AppConfiguration.CopySaveFiles)
                {
                    MessageCheckBox message = new MessageCheckBox("Copy Save Files Disabled",
                                                                  "Copy save files is disabled and the load latest save feature may not function.\n\nSelect the check box below to enable this setting.",
                                                                  "Enable Setting", SystemIcons.Warning);
                    message.StartPosition = FormStartPosition.CenterParent;
                    message.ShowDialog(this);
                    if (message.Checked)
                    {
                        AppConfiguration.EnableCopySaveFiles();
                    }
                }
                playAdapter.LoadSaveFile = GetLoadLatestSave(form.GameFile, form.SelectedSourcePort);
            }

            playAdapter.ProcessExited += processExited;
            if (form.SelectedDemo != null)
            {
                playAdapter.PlayDemoFile = Path.Combine(appConfig.DemoDirectory.GetFullPath(), form.SelectedDemo.FileName);
            }
            return(playAdapter);
        }