public static List <SourceGame> getGamesList() { List <SourceGame> listOfSourceGames = SourceGames.GetUnprocessedGamesList(); listOfSourceGames = SourceGames.checkGamesInstalled(listOfSourceGames); return(listOfSourceGames); }
public TuxieLauncher() { InitializeComponent(); _syncContext = SynchronizationContext.Current; // Loads the settings. The config name = the path it will look for the config in. settings = Settings.Load(configname); updateorigdirectory(); updatebindir(); // Find a list of all the games and steam directories SourceGames.Init(); // Put some debug info in some boxes lblMainSteam.Text = "Main steam directory: " + SourceGames.mainSteamDir; lblSteamDirs.Text = "Steam stores detected: \n" + string.Join("\n", SourceGames.steamStores); // It's time to look through the list of games, to: // - Add them to the list of games you can mount the content off // - Find the correct directory of the tools. // - Find all the possible entity definitions (.fgd's), and stuff them into a list. // TODO: Move the directory portion into a seperate function // TODO: Warn about using gmod tools, and kick up a link to install source sdk // TODO: Refactor away the code for selecting the target directory List <string> fgdlist = new List <string>(); foreach (SourceGame g in SourceGames.games) { // We only want to add the games that are actually, you know, installed. if (g.Installed) { // Add the games to the list of games you can mod for, and use tools from // Here, we check if we have already saved what tools/games to use, and if so select them in the drop down boxes if (g.IsMappableGame) { int tempgameid = ddGameToModFor.Items.Add(g.Directory); if (g.Directory == settings.gamedir) { ddGameToModFor.SelectedIndex = tempgameid; settings.origgame = g; } } if (g.IsTool) { int temptoolid = ddTools.Items.Add(g.Directory); if (g.Directory == settings.tooldir) { ddTools.SelectedIndex = temptoolid; } } // Add the list of content we can mount.. contentMountListBox.Items.Add(g.ProperName + " -> " + g.Directory, CheckState.Checked); // And finally, add all the FGD's (entity definitions) we can find :). try { fgdlist.AddRange(System.IO.Directory.GetFiles(g.Directory + "\\bin\\", "*.fgd")); fgdlist.AddRange(System.IO.Directory.GetFiles(g.Directory + "\\garrysmod\\gamemodes\\", "*.fgd", SearchOption.AllDirectories)); } catch (Exception e) { } } } // Oh, and, this section here deals with checking off those fgd's that are already saved from the last time. Should probably move this. string gameconfigcontents = ""; try { gameconfigcontents = File.ReadAllText(targetdirectory + "\\gameconfig.txt", Encoding.ASCII); } catch (Exception e) { } foreach (string filename in fgdlist) { chkLbFgd.Items.Add(filename, gameconfigcontents.Contains(filename)); } }