Example #1
0
        private bool StartPlay(IGameFile gameFile, ISourcePortData sourcePort, bool screenFilter)
        {
            GameFilePlayAdapter playAdapter = CreatePlayAdapter(m_currentPlayForm, playAdapter_ProcessExited, AppConfiguration);

            m_saveGames = new IFileData[] { };

            if (AppConfiguration.CopySaveFiles)
            {
                CopySaveGames(gameFile, sourcePort);
            }
            CreateFileDetectors(sourcePort);

            if (m_currentPlayForm.PreviewLaunchParameters)
            {
                ShowLaunchParameters(playAdapter, gameFile, sourcePort);
            }

            bool isGameFileIwad = IsGameFileIwad(gameFile);

            if (m_currentPlayForm.SaveStatistics)
            {
                SetupStatsReader(sourcePort, gameFile);
            }

            if (playAdapter.Launch(AppConfiguration.GameFileDirectory, AppConfiguration.TempDirectory,
                                   gameFile, sourcePort, isGameFileIwad))
            {
                m_currentPlayFile = gameFile;

                if (gameFile != null)
                {
                    gameFile.LastPlayed = DateTime.Now;
                    m_dtStartPlay       = DateTime.Now;
                    DataSourceAdapter.UpdateGameFile(gameFile, new GameFileFieldType[] { GameFileFieldType.LastPlayed });
                    UpdateDataSourceViews(gameFile);
                }
            }
            else
            {
                MessageBox.Show(this, playAdapter.LastError, "Launch Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (screenFilter)
            {
                m_filterForm = new FilterForm(Screen.FromControl(this), m_currentPlayForm.GetFilterSettings());
                m_filterForm.Show(this);
            }

            return(true);
        }