mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-19 00:51:30 -07:00
22 lines
664 B
C#
22 lines
664 B
C#
using Microsoft.Win32;
|
|
|
|
namespace Bloxstrap.Extensions
|
|
{
|
|
public static class RegistryKeyEx
|
|
{
|
|
public static void SetValueSafe(this RegistryKey registryKey, string? name, object value)
|
|
{
|
|
try
|
|
{
|
|
App.Logger.WriteLine("RegistryKeyEx::SetValueSafe", $"Writing '{value}' to {registryKey}\\{name}");
|
|
registryKey.SetValue(name, value);
|
|
}
|
|
catch (UnauthorizedAccessException)
|
|
{
|
|
Frontend.ShowMessageBox(Strings.Dialog_RegistryWriteError, System.Windows.MessageBoxImage.Error);
|
|
App.Terminate();
|
|
}
|
|
}
|
|
}
|
|
}
|