Exemplo n.º 1
0
 private void Setup_Game_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (loaded)
     {
         var game = (e.AddedItems[0] as SourceGame);
         SourceGameManager.ChangeSelectedGame(game);
         cmdReader.ChangeSelectedGame(game);
         if (conUI != null)
         {
             conUI.Render();
         }
     }
 }
Exemplo n.º 2
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);
                }
            }
        }