using System; using System.Runtime.InteropServices; using RynthCore.Install; namespace RynthCore.App.Avalonia; /// /// One-shot values the installer leaves under Software\Rynth for the launcher /// (e.g. PendingPluginRegistration). Kept out of the shared, read-only /// , which must stay byte-identical with RynthSuite's copy. /// internal static class InstallerHandoff { /// A string value from Software\Rynth: HKCU first, then HKLM (32-bit view); null when absent. public static string? ReadSetting(string valueName) => SystemInstallSettings.Instance.CurrentUser(valueName) ?? SystemInstallSettings.Instance.LocalMachine(valueName); /// Deletes a value from HKCU Software\Rynth once it has been acted on. Best effort. public static void DeleteUserSetting(string valueName) { try { RegDeleteKeyValueW(HKEY_CURRENT_USER, RynthInstallPaths.RegistryKey, valueName); } catch { } } private static readonly IntPtr HKEY_CURRENT_USER = new(unchecked((int)0x80000001)); [DllImport("advapi32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)] private static extern int RegDeleteKeyValueW(IntPtr hkey, string lpSubKey, string lpValueName); }