Skip to content

Commit

Permalink
Fixed the order of ids 🆔
Browse files Browse the repository at this point in the history
  • Loading branch information
Inestic committed May 18, 2022
1 parent 7cba02f commit f851e3c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion SophiApp/SophiApp/Helpers/RegHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace SophiApp.Helpers
{
internal class RegHelper
{
private static RegistryKey GetKey(RegistryHive hive, string keyPath) => RegistryKey.OpenBaseKey(hive, RegistryView.Registry64).OpenSubKey(keyPath);
private static RegistryKey GetKey(RegistryHive hive, string keyPath) => RegistryKey.OpenBaseKey(hive, RegistryView.Registry64)?.OpenSubKey(keyPath);

private static RegistryKey SetKey(RegistryHive hive, string keyPath) => RegistryKey.OpenBaseKey(hive, RegistryView.Registry64).OpenSubKey(keyPath, true) ?? RegistryKey.OpenBaseKey(hive, RegistryView.Registry64).CreateSubKey(keyPath, true);

Expand Down
13 changes: 10 additions & 3 deletions SophiApp/SophiApp/Helpers/VisualRedistrLibsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,18 @@ internal static Version GetInstalledVersion()

internal static bool IsInstalled()
{
var vcRegistryPath = RegHelper.GetSubKeyNames(RegistryHive.ClassesRoot, REDISTRX64_REGISTRY_PATH)
try
{
var vcRegistryPath = RegHelper.GetSubKeyNames(RegistryHive.ClassesRoot, REDISTRX64_REGISTRY_PATH)
.FirstOrDefault(key => key.Contains(REDISTRX64_REGISTRY_NAME_PATTERN));

return vcRegistryPath != null && RegHelper.GetStringValue(RegistryHive.ClassesRoot, vcRegistryPath, DISPLAY_NAME)
.Contains(MSREDISTR_LIB_VS_2022_NAME);
return vcRegistryPath != null && RegHelper.GetStringValue(RegistryHive.ClassesRoot, vcRegistryPath, DISPLAY_NAME)
.Contains(MSREDISTR_LIB_VS_2022_NAME);
}
catch (Exception)
{
return false;
}
}
}
}

0 comments on commit f851e3c

Please sign in to comment.