Пример #1
0
        private void HandlePlaySettings(PlayForm form, IGameFile gameFile)
        {
            if (form.RememberSettings && gameFile != null)
            {
                gameFile.SourcePortID = gameFile.IWadID = null;

                if (form.SelectedSourcePort != null)
                {
                    gameFile.SourcePortID = form.SelectedSourcePort.SourcePortID;
                }
                if (form.SelectedIWad != null)
                {
                    gameFile.IWadID = form.SelectedIWad.IWadID;
                }

                if (form.SelectedMap != null)
                {
                    gameFile.SettingsMap = form.SelectedMap;
                }
                else
                {
                    gameFile.SettingsMap = string.Empty;  //this setting can be turned off
                }
                if (form.SelectedSkill != null)
                {
                    gameFile.SettingsSkill = form.SelectedSkill;
                }
                if (form.ExtraParameters != null)
                {
                    gameFile.SettingsExtraParams = form.ExtraParameters;
                }

                gameFile.SettingsStat = form.SaveStatistics;

                if (form.ShouldSaveAdditionalFiles())
                {
                    gameFile.SettingsFiles           = string.Join(";", form.GetAdditionalFiles().Select(x => x.FileName).ToArray());
                    gameFile.SettingsFilesIWAD       = string.Join(";", form.GetIWadAdditionalFiles().Select(x => x.FileName).ToArray());
                    gameFile.SettingsFilesSourcePort = string.Join(";", form.GetSourcePortAdditionalFiles().Select(x => x.FileName).ToArray());

                    if (form.SpecificFiles != null)
                    {
                        gameFile.SettingsSpecificFiles = string.Join(";", form.SpecificFiles);
                    }
                    else
                    {
                        gameFile.SettingsSpecificFiles = string.Empty; //this setting can be turned off
                    }
                }

                DataSourceAdapter.UpdateGameFile(gameFile, new GameFileFieldType[] { GameFileFieldType.SourcePortID, GameFileFieldType.IWadID, GameFileFieldType.SettingsMap,
                                                                                     GameFileFieldType.SettingsSkill, GameFileFieldType.SettingsFiles, GameFileFieldType.SettingsExtraParams, GameFileFieldType.SettingsSpecificFiles, GameFileFieldType.SettingsStat,
                                                                                     GameFileFieldType.SettingsFilesIWAD, GameFileFieldType.SettingsFilesSourcePort });
            }
        }
Пример #2
0
        private static 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.ProcessExited  += processExited;
            if (form.SelectedDemo != null)
            {
                playAdapter.PlayDemoFile = Path.Combine(appConfig.DemoDirectory.GetFullPath(), form.SelectedDemo.FileName);
            }
            return(playAdapter);
        }
Пример #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);
        }