forgot to add registry.cs

This commit is contained in:
murdle 2025-05-01 16:58:10 -07:00
parent e9924bded2
commit 4bc7d806a0

View File

@ -0,0 +1,23 @@
using Microsoft.Win32;
namespace RobloxLegacy.Utilities;
public class Registry
{
private static RegistryKey? OpenKey(bool writable = true)
{
return Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\RobloxLegacy", writable);
}
public static void SaveVersion(string appName, string version)
{
using var key = OpenKey();
key?.SetValue($"{appName}Version", version, RegistryValueKind.String);
}
public static string? GetVersion(string appName)
{
using var key = OpenKey(false);
return key?.GetValue($"{appName}Version") as string;
}
}