From 0ec70e42c0741b061f8c8f91b66ea28c4290118c Mon Sep 17 00:00:00 2001 From: Terry MacDonald Date: Sat, 10 Apr 2021 23:13:05 +1200 Subject: [PATCH] Updated develop changes to match Updated the develop branch changes from v1.0.4 to the new string based GameIDs that we've moved to in order to support the Origin game ids. --- DisplayMagician/GameLibraries/SteamLibrary.cs | 17 +++++++++-------- DisplayMagician/GameLibraries/UplayLibrary.cs | 2 +- DisplayMagician/ShortcutItem.cs | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/DisplayMagician/GameLibraries/SteamLibrary.cs b/DisplayMagician/GameLibraries/SteamLibrary.cs index a92de88..fc8ca92 100644 --- a/DisplayMagician/GameLibraries/SteamLibrary.cs +++ b/DisplayMagician/GameLibraries/SteamLibrary.cs @@ -230,7 +230,7 @@ namespace DisplayMagician.GameLibraries if (String.IsNullOrWhiteSpace(steamGameNameOrId)) return false; - logger.Debug($"SteamLibrary/RemoveSteamGame3: Removing Steam game with Name or UUID {steamGameNameOrUuid} from the Steam library"); + logger.Debug($"SteamLibrary/RemoveSteamGame3: Removing Steam game with Name or UUID {steamGameNameOrId} from the Steam library"); int numRemoved; Match match = Regex.Match(steamGameNameOrId, steamAppIdRegex, RegexOptions.IgnoreCase); @@ -241,12 +241,12 @@ namespace DisplayMagician.GameLibraries if (numRemoved == 1) { - logger.Debug($"SteamLibrary/RemoveSteamGame3: Removed Steam game with Name or UUID {steamGameNameOrUuid} "); + logger.Debug($"SteamLibrary/RemoveSteamGame3: Removed Steam game with Name or UUID {steamGameNameOrId} "); return true; } else if (numRemoved == 0) { - logger.Debug($"SteamLibrary/RemoveSteamGame3: Didn't remove Steam game with Name or UUID {steamGameNameOrUuid} from the Steam Library"); + logger.Debug($"SteamLibrary/RemoveSteamGame3: Didn't remove Steam game with Name or UUID {steamGameNameOrId} from the Steam Library"); return false; } else @@ -376,13 +376,13 @@ namespace DisplayMagician.GameLibraries { // // Loop through the subKeys as they are the Steam Game IDs - foreach (string steamGameKeyName in steamAppsKey.GetSubKeyNames()) + foreach (string steamAppId in steamAppsKey.GetSubKeyNames()) { - logger.Trace($"SteamLibrary/LoadInstalledGames: Found SteamGameKeyName = {steamGameKeyName}"); - if (int.TryParse(steamGameKeyName, out int steamAppId)) + logger.Trace($"SteamLibrary/LoadInstalledGames: Found SteamGameKeyName = {steamAppId}"); + if (!String.IsNullOrWhiteSpace(steamAppId)) { logger.Trace($"SteamLibrary/LoadInstalledGames: SteamGameKeyName is an int, so trying to see if it is an installed app"); - string steamGameKeyFullName = $"{_registryAppsKey}\\{steamGameKeyName}"; + string steamGameKeyFullName = $"{_registryAppsKey}\\{steamAppId}"; using (RegistryKey steamGameKey = Registry.CurrentUser.OpenSubKey(steamGameKeyFullName, RegistryKeyPermissionCheck.ReadSubTree)) { // If the Installed Value is set to 1, then the game is installed @@ -578,8 +578,9 @@ namespace DisplayMagician.GameLibraries Match appidMatches = appidRegex.Match(steamLibraryAppManifestText); if (appidMatches.Success) { - if (int.TryParse(appidMatches.Groups[1].Value, out int steamGameId)) + if (!String.IsNullOrWhiteSpace(appidMatches.Groups[1].Value)) { + string steamGameId = appidMatches.Groups[1].Value; logger.Trace($"SteamLibrary/LoadInstalledGames: Found Steam Game ID {steamGameId} within {steamLibraryAppManifestFilename} steam app manifest within steam library {steamLibraryPath}"); // Check if this game is one that was installed if (steamAppInfo.ContainsKey(steamGameId)) diff --git a/DisplayMagician/GameLibraries/UplayLibrary.cs b/DisplayMagician/GameLibraries/UplayLibrary.cs index 8857c14..c621b42 100644 --- a/DisplayMagician/GameLibraries/UplayLibrary.cs +++ b/DisplayMagician/GameLibraries/UplayLibrary.cs @@ -577,7 +577,7 @@ namespace DisplayMagician.GameLibraries logger.Trace($"UplayLibrary/LoadInstalledGames: uplayGameAppInfo.GameInstallDir = {uplayGameAppInfo.GameInstallDir }"); uplayGameAppInfo.GameExe = Path.Combine(uplayGameAppInfo.GameInstallDir, gameFileName); logger.Trace($"UplayLibrary/LoadInstalledGames: uplayGameAppInfo.GameExe = {uplayGameAppInfo.GameExe }"); - uplayGameAppInfo.GameID = int.Parse(gameId); + uplayGameAppInfo.GameID = gameId; logger.Trace($"UplayLibrary/LoadInstalledGames: uplayGameAppInfo.GameID = {uplayGameAppInfo.GameID }"); } else diff --git a/DisplayMagician/ShortcutItem.cs b/DisplayMagician/ShortcutItem.cs index 7f9672d..9b47c24 100644 --- a/DisplayMagician/ShortcutItem.cs +++ b/DisplayMagician/ShortcutItem.cs @@ -2031,7 +2031,7 @@ namespace DisplayMagician } // We need to look up details about the game - if (!SteamLibrary.ContainsSteamGameId(GameAppId)) + if (!SteamLibrary.ContainsSteamGameById(GameAppId)) { ShortcutError error = new ShortcutError(); error.Name = "SteamGameNotInstalled";