RhSolutions-AddIn/Source/AddIn/RegistryUtil.cs

43 lines
1.1 KiB
C#
Raw Normal View History

2021-12-17 09:07:03 +03:00
using Microsoft.Win32;
namespace RehauSku
{
static class RegistryUtil
{
public static string PriceListPath
{
2021-12-22 08:26:54 +03:00
get => (string)_RootKey.GetValue("PriceListPath");
2021-12-17 09:07:03 +03:00
}
public static ResponseOrder StoreResponseOrder
{
2021-12-22 08:26:54 +03:00
get => (ResponseOrder)_RootKey.GetValue("StoreResponseOrder");
}
2021-12-17 09:07:03 +03:00
2021-12-22 08:26:54 +03:00
private static RegistryKey _RootKey
{
get
2021-12-17 09:07:03 +03:00
{
2021-12-22 08:26:54 +03:00
return _OpenRootKey() ?? _CreateRootKey();
2021-12-17 09:07:03 +03:00
}
}
2021-12-22 08:26:54 +03:00
private static RegistryKey _OpenRootKey()
{
return Registry.CurrentUser
.OpenSubKey(@"SOFTWARE\REHAU\SkuAssist");
}
2021-12-17 09:07:03 +03:00
2021-12-22 08:26:54 +03:00
private static RegistryKey _CreateRootKey()
2021-12-17 09:07:03 +03:00
{
2021-12-22 08:26:54 +03:00
RegistryKey key = Registry.CurrentUser
.CreateSubKey(@"SOFTWARE\REHAU\SkuAssist");
key.SetValue("PriceListPath", @"D:\Dropbox\Рабочее\Таблица заказов ИС EAE_2021.xlsm");
key.SetValue("StoreResponseOrder", 0);
return key;
2021-12-17 09:07:03 +03:00
}
}
}