mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Avoiding missing uplay_id game ids
Some Uplay Games have the uplay_id set to zero, when they shouldn't be. Havign to take the Game ID from the Reg key path to compensate.
This commit is contained in:
parent
cf1ff873ef
commit
a230a43fa0
@ -545,6 +545,7 @@ namespace DisplayMagician.GameLibraries
|
|||||||
productInfo = deserializer.Deserialize<ProductInformation>(item.GameInfo);
|
productInfo = deserializer.Deserialize<ProductInformation>(item.GameInfo);
|
||||||
var root = productInfo.root;
|
var root = productInfo.root;
|
||||||
|
|
||||||
|
string gameId = "";
|
||||||
string gameName = "";
|
string gameName = "";
|
||||||
string gameExePath = "";
|
string gameExePath = "";
|
||||||
string gameIconPath = "";
|
string gameIconPath = "";
|
||||||
@ -599,12 +600,19 @@ namespace DisplayMagician.GameLibraries
|
|||||||
regKeyText = regKeyText.Replace(@"\InstallDir", "");
|
regKeyText = regKeyText.Replace(@"\InstallDir", "");
|
||||||
regKeyText = regKeyText.Replace(@"Ubisoft", @"WOW6432Node\Ubisoft");
|
regKeyText = regKeyText.Replace(@"Ubisoft", @"WOW6432Node\Ubisoft");
|
||||||
logger.Trace($"UplayLibrary/GetInstallDirFromRegKey: Accessing HKLM reg key {regKeyText}");
|
logger.Trace($"UplayLibrary/GetInstallDirFromRegKey: Accessing HKLM reg key {regKeyText}");
|
||||||
|
|
||||||
if (this.GetInstallDirFromRegKey(regKeyText, out exePath))
|
if (this.GetInstallDirFromRegKey(regKeyText, out exePath))
|
||||||
{
|
{
|
||||||
gameExePath = Path.Combine(exePath, executable.path.relative);
|
gameExePath = Path.Combine(exePath, executable.path.relative);
|
||||||
logger.Trace($"UplayLibrary/LoadInstalledGames: Relative executable uses local machine registry key: {executable.working_directory.register} ");
|
logger.Trace($"UplayLibrary/LoadInstalledGames: Relative executable uses local machine registry key: {executable.working_directory.register} ");
|
||||||
}
|
}
|
||||||
|
// Get the GameID from the reg key
|
||||||
|
string pattern = @"Installs\\(\d+)\\InstallDir";
|
||||||
|
MatchCollection mc = Regex.Matches(executable.working_directory.register, pattern);
|
||||||
|
if (mc.Count > 0)
|
||||||
|
{
|
||||||
|
gameId = mc[0].Groups[1].Value;
|
||||||
|
}
|
||||||
|
logger.Trace($"UplayLibrary/LoadInstalledGames: Got uplay Game ID: {gameId} ");
|
||||||
}
|
}
|
||||||
/*else if (executable.working_directory.register.StartsWith("HKEY_CURRENT_USER"))
|
/*else if (executable.working_directory.register.StartsWith("HKEY_CURRENT_USER"))
|
||||||
{
|
{
|
||||||
@ -620,6 +628,14 @@ namespace DisplayMagician.GameLibraries
|
|||||||
gameExePath = Path.Combine(exePath, executable.path.relative);
|
gameExePath = Path.Combine(exePath, executable.path.relative);
|
||||||
logger.Trace($"UplayLibrary/LoadInstalledGames: Relative executable uses current user registry key: {executable.working_directory.register} ");
|
logger.Trace($"UplayLibrary/LoadInstalledGames: Relative executable uses current user registry key: {executable.working_directory.register} ");
|
||||||
}
|
}
|
||||||
|
// Get the GameID from the reg key
|
||||||
|
string pattern = @"Installs\\(\d+)\\InstallDir";
|
||||||
|
MatchCollection mc = Regex.Matches(executable.working_directory.register, pattern);
|
||||||
|
if (mc.Count > 0)
|
||||||
|
{
|
||||||
|
gameId = mc[0].Groups[1].Value;
|
||||||
|
}
|
||||||
|
logger.Trace($"UplayLibrary/LoadInstalledGames: Got uplay Game ID: {gameId} ");
|
||||||
}*/
|
}*/
|
||||||
else if (!String.IsNullOrEmpty(executable.working_directory.append))
|
else if (!String.IsNullOrEmpty(executable.working_directory.append))
|
||||||
{
|
{
|
||||||
@ -627,6 +643,8 @@ namespace DisplayMagician.GameLibraries
|
|||||||
gameExePath = Path.Combine(executable.working_directory.append, executable.path.relative);
|
gameExePath = Path.Combine(executable.working_directory.append, executable.path.relative);
|
||||||
gameIconPath = Path.Combine(executable.working_directory.append, executable.icon_image);
|
gameIconPath = Path.Combine(executable.working_directory.append, executable.icon_image);
|
||||||
logger.Trace($"UplayLibrary/LoadInstalledGames: Relative executable uses appended file path: {executable.working_directory.append} ");
|
logger.Trace($"UplayLibrary/LoadInstalledGames: Relative executable uses appended file path: {executable.working_directory.append} ");
|
||||||
|
gameId = productInfo.uplay_id.ToString();
|
||||||
|
logger.Trace($"UplayLibrary/LoadInstalledGames: Got uplay Game ID: {gameId} ");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -674,7 +692,7 @@ namespace DisplayMagician.GameLibraries
|
|||||||
// Now we need to save the game name, cause if we're here then we're good enough to save
|
// Now we need to save the game name, cause if we're here then we're good enough to save
|
||||||
// Then we have the gameID, the thumbimage, the icon, the name, the exe path
|
// Then we have the gameID, the thumbimage, the icon, the name, the exe path
|
||||||
// And we add the Game to the list of games we have!
|
// And we add the Game to the list of games we have!
|
||||||
_allGames.Add(new UplayGame(productInfo.uplay_id.ToString(), gameName, gameExePath, gameIconPath));
|
_allGames.Add(new UplayGame(gameId, gameName, gameExePath, gameIconPath));
|
||||||
logger.Trace($"UplayLibrary/LoadInstalledGames: Adding Uplay Game with game id {productInfo.uplay_id}, name {gameName}, game exe {gameExePath} and icon path {gameIconPath}");
|
logger.Trace($"UplayLibrary/LoadInstalledGames: Adding Uplay Game with game id {productInfo.uplay_id}, name {gameName}, game exe {gameExePath} and icon path {gameIconPath}");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -707,6 +725,15 @@ namespace DisplayMagician.GameLibraries
|
|||||||
gameExePath = Path.Combine(exePath, executable.path.relative);
|
gameExePath = Path.Combine(exePath, executable.path.relative);
|
||||||
logger.Trace($"UplayLibrary/LoadInstalledGames: Relative executable uses local machine registry key: {executable.working_directory.register} ");
|
logger.Trace($"UplayLibrary/LoadInstalledGames: Relative executable uses local machine registry key: {executable.working_directory.register} ");
|
||||||
}
|
}
|
||||||
|
// Get the GameID from the reg key
|
||||||
|
string pattern = @"Installs\\(\d+)\\InstallDir";
|
||||||
|
MatchCollection mc = Regex.Matches(executable.working_directory.register, pattern);
|
||||||
|
if (mc.Count > 0)
|
||||||
|
{
|
||||||
|
gameId = mc[0].Groups[1].Value;
|
||||||
|
}
|
||||||
|
logger.Trace($"UplayLibrary/LoadInstalledGames: Got uplay Game ID: {gameId} ");
|
||||||
|
|
||||||
}
|
}
|
||||||
/*else if (executable.working_directory.register.StartsWith("HKEY_CURRENT_USER"))
|
/*else if (executable.working_directory.register.StartsWith("HKEY_CURRENT_USER"))
|
||||||
{
|
{
|
||||||
@ -722,6 +749,14 @@ namespace DisplayMagician.GameLibraries
|
|||||||
gameExePath = Path.Combine(exePath, executable.path.relative);
|
gameExePath = Path.Combine(exePath, executable.path.relative);
|
||||||
logger.Trace($"UplayLibrary/LoadInstalledGames: Relative executable uses current user registry key: {executable.working_directory.register} ");
|
logger.Trace($"UplayLibrary/LoadInstalledGames: Relative executable uses current user registry key: {executable.working_directory.register} ");
|
||||||
}
|
}
|
||||||
|
// Get the GameID from the reg key
|
||||||
|
string pattern = @"Installs\\(\d+)\\InstallDir";
|
||||||
|
MatchCollection mc = Regex.Matches(executable.working_directory.register, pattern);
|
||||||
|
if (mc.Count > 0)
|
||||||
|
{
|
||||||
|
gameId = mc[0].Groups[1].Value;
|
||||||
|
}
|
||||||
|
logger.Trace($"UplayLibrary/LoadInstalledGames: Got uplay Game ID: {gameId} ");
|
||||||
}*/
|
}*/
|
||||||
else if (!String.IsNullOrEmpty(executable.working_directory.append))
|
else if (!String.IsNullOrEmpty(executable.working_directory.append))
|
||||||
{
|
{
|
||||||
@ -729,6 +764,8 @@ namespace DisplayMagician.GameLibraries
|
|||||||
gameExePath = Path.Combine(executable.working_directory.append, executable.path.relative);
|
gameExePath = Path.Combine(executable.working_directory.append, executable.path.relative);
|
||||||
gameIconPath = Path.Combine(executable.working_directory.append, executable.icon_image);
|
gameIconPath = Path.Combine(executable.working_directory.append, executable.icon_image);
|
||||||
logger.Trace($"UplayLibrary/LoadInstalledGames: Relative executable uses appended file path: {executable.working_directory.append} ");
|
logger.Trace($"UplayLibrary/LoadInstalledGames: Relative executable uses appended file path: {executable.working_directory.append} ");
|
||||||
|
gameId = productInfo.uplay_id.ToString();
|
||||||
|
logger.Trace($"UplayLibrary/LoadInstalledGames: Got uplay Game ID: {gameId} ");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -776,7 +813,7 @@ namespace DisplayMagician.GameLibraries
|
|||||||
// Now we need to save the game name, cause if we're here then we're good enough to save
|
// Now we need to save the game name, cause if we're here then we're good enough to save
|
||||||
// Then we have the gameID, the thumbimage, the icon, the name, the exe path
|
// Then we have the gameID, the thumbimage, the icon, the name, the exe path
|
||||||
// And we add the Game to the list of games we have!
|
// And we add the Game to the list of games we have!
|
||||||
_allGames.Add(new UplayGame(productInfo.uplay_id.ToString(), gameName, gameExePath, gameIconPath));
|
_allGames.Add(new UplayGame(gameId, gameName, gameExePath, gameIconPath));
|
||||||
logger.Trace($"UplayLibrary/LoadInstalledGames: Adding Uplay Game with game id {productInfo.uplay_id}, name {gameName}, game exe {gameExePath} and icon path {gameIconPath}");
|
logger.Trace($"UplayLibrary/LoadInstalledGames: Adding Uplay Game with game id {productInfo.uplay_id}, name {gameName}, game exe {gameExePath} and icon path {gameIconPath}");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,8 @@ using System.Resources;
|
|||||||
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
|
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
|
||||||
|
|
||||||
// Version information
|
// Version information
|
||||||
[assembly: AssemblyVersion("2.0.1.149")]
|
[assembly: AssemblyVersion("2.0.1.159")]
|
||||||
[assembly: AssemblyFileVersion("2.0.1.149")]
|
[assembly: AssemblyFileVersion("2.0.1.159")]
|
||||||
[assembly: NeutralResourcesLanguageAttribute( "en" )]
|
[assembly: NeutralResourcesLanguageAttribute( "en" )]
|
||||||
[assembly: CLSCompliant(true)]
|
[assembly: CLSCompliant(true)]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user