private Game GetGameInformation(Match gameMatch) { string matchContent = gameMatch.ToString(); if (matchContent.Contains("DecryptionKey")) { return(new NullGame()); } // Gets the game ID string gameIdRegex = @"\u0022(\d)+\u0022"; Int64 gameId = Int64.Parse(Regex.Match(matchContent, gameIdRegex).ToString().Replace("\"", "")); // Makes sure the game is installed string installedAndUpToDate = @"\u0022HasAllLocalContent\u0022\s*\u0022\d\u0022"; string hasLocalContentLine = Regex.Match(matchContent, installedAndUpToDate).ToString(); // After retargeting to .NET 4.0, experienced a weird issue here where no line was being returned. if (hasLocalContentLine == "") { return(new NullGame()); } var isInstalled = IsInstalled(hasLocalContentLine); if (isInstalled == 0) { return(new NullGame()); } var game = new SteamGame(gameId); game.Name = GetGameName(gameId); if (game.Name == gameId.ToString()) { game.Name = GetGameNameFromConfigSection(matchContent); } return(game); }
private IDictionary <string, Game> FindAllSteamGamesFromManifestFiles() { var manifestGames = new Dictionary <string, Game>(); foreach (string dir in gameInstallDirs) { string steamAppsDir = ManifestPathStringBuilder(dir).ToString(); if (Directory.Exists(steamAppsDir)) { List <string> manifestFiles = new List <string>(Directory.EnumerateFiles(steamAppsDir)); foreach (var manifestFile in manifestFiles) { if (manifestFile.Contains("appmanifest_")) { string[] splitManifest = manifestFile.Split(new string[] { "appmanifest_" }, StringSplitOptions.None); Int64 gameId = Int64.Parse(splitManifest[1].Replace(".acf", "")); Game manifestGame = new SteamGame(gameId); if (manifestGames.ContainsKey(manifestGame.Hash())) { continue; } manifestGame.Name = GetGameName(gameId); if (manifestGame.Name != String.Empty) { manifestGames.Add(manifestGame.Hash(), manifestGame); } } } } } return(manifestGames); }