using Microsoft.Win32; using System; namespace AnotherReplayReader.Utils { internal static class RegistryUtils { public static string? Retrieve(RegistryHive hive, string path, string value) { try { using var view32 = RegistryKey.OpenBaseKey(hive, RegistryView.Registry32); using var ra3Key = view32.OpenSubKey(path, false); return ra3Key?.GetValue(value) as string; } catch (Exception e) { Debug.Instance.DebugMessage += $"Failed to retrieve registy {hive}:{path}:{value}: {e}"; return null; } } public static string? RetrieveInRa3(RegistryHive hive, string value) { return Retrieve(hive, @"Software\Electronic Arts\Electronic Arts\Red Alert 3", value); } } }