Beispiel #1
0
        private void GameGridMouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (_updatingGameGrid)
            {
                return;
            }

            if (GameGrid.SelectedRows.Count != 1)
            {
                return;
            }

            RvFile tGame = gameGrid[GameGrid.SelectedRows[0].Index];

            if (tGame.Game == null)
            {
                UpdateGameGrid(tGame);
                DirTree.SetSelected(tGame);
            }
            else
            {
                string path = tGame.Parent.DatTreeFullName;
                if (Settings.rvSettings?.EInfo == null)
                {
                    return;
                }

                foreach (EmulatorInfo ei in Settings.rvSettings.EInfo)
                {
                    if (!string.Equals(path, ei.TreeDir, StringComparison.CurrentCultureIgnoreCase))
                    {
                        continue;
                    }

                    if (string.IsNullOrWhiteSpace(ei.CommandLine))
                    {
                        continue;
                    }

                    string commandLineOptions = ei.CommandLine;
                    string dirname            = tGame.Parent.FullName;
                    commandLineOptions = commandLineOptions.Replace("{gamename}", Path.GetFileNameWithoutExtension(tGame.Name));
                    commandLineOptions = commandLineOptions.Replace("{gamefilename}", tGame.Name);
                    commandLineOptions = commandLineOptions.Replace("{gamedirectory}", dirname);
                    using (Process exeProcess = new Process())
                    {
                        exeProcess.StartInfo.WorkingDirectory = ei.WorkingDirectory;
                        exeProcess.StartInfo.FileName         = ei.ExeName;
                        exeProcess.StartInfo.Arguments        = commandLineOptions;
                        exeProcess.StartInfo.UseShellExecute  = false;
                        exeProcess.StartInfo.CreateNoWindow   = true;
                        exeProcess.Start();
                    }

                    return;
                }
            }
        }