Exemple #1
0
        private async void FindSteamApps()
        {
            if (string.IsNullOrWhiteSpace(PathManager.steamApps))
            {
                //Finds all proccesses that have "Steam" in them
                Process[] procs = Process.GetProcessesByName("Steam");
                Process   steam = null;

                string steamPath;
                if (procs.Length > 0)
                {
                    //Gets actual Steam process
                    steam = procs[0];

                    //Gets steam directory
                    steamPath                = Path.GetDirectoryName(steam.MainModule.FileName);
                    PathManager.steamApps    = steamPath + @"\SteamApps";
                    steamAppsFolderPath.Text = PathManager.steamApps;

                    //Gets the current game
                    SourceGame game = SourceGameManager.getByName(Setup_Game.Text);
                    Setup_steamAppsLabel.Content = "SteamApps Folder (Found)";

                    //Init things that need the steamapps folder
                    conUI     = new ConsoleUI(game, ref afm, ref mw);
                    cmdReader = new CommandReader(ref qss, ref ape, ref afm, game);
                }
                else
                {
                    //keep looking for the steam process each 500ms
                    await Task.Delay(new TimeSpan(0, 0, 0, 0, 500));

                    FindSteamApps();
                }
            }
            else
            {
                //Gets the current game
                SourceGame game = SourceGameManager.getByName(Setup_Game.Text);
                Setup_steamAppsLabel.Content = "SteamApps Folder (Found)";

                //Init things that need the steamapps folder
                if (!Directory.Exists(PathManager.steamApps + PathManager.steamApps + @"\common\Team Fortress 2"))
                {
                    conUI     = new ConsoleUI(game, ref afm, ref mw);
                    cmdReader = new CommandReader(ref qss, ref ape, ref afm, game);
                }
            }
        }
Exemple #2
0
        private void steamAppsFolderSelectButton_Click(object sender, EventArgs e)
        {
            using (var fbd = new System.Windows.Forms.FolderBrowserDialog()) {
                fbd.ShowDialog();
                //true if clicks OK, false otherwise
                if (DialogResult ?? true)
                {
                    if (!string.IsNullOrWhiteSpace(fbd.SelectedPath))
                    {
                        PathManager.steamApps    = fbd.SelectedPath;
                        steamAppsFolderPath.Text = fbd.SelectedPath;

                        conUI = null;
                        conUI = new ConsoleUI(SourceGameManager.selectedGame, ref afm, ref mw);

                        cmdReader = null;
                        cmdReader = new CommandReader(ref qss, ref ape, ref afm, SourceGameManager.selectedGame);
                    }
                }
            }
        }
Exemple #3
0
 public void setCmdReadertoNull()
 {
     cmdReader = null;
 }