-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRegistryHelper.cs
More file actions
29 lines (25 loc) · 876 Bytes
/
RegistryHelper.cs
File metadata and controls
29 lines (25 loc) · 876 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Azure Open AI Chat Client (Using Semantic Kernel)
using Microsoft.Win32;
namespace AzureOpenAIChat
{
// helper to access the Windows Registry
internal static class RegistryHelper
{
// Registry Key
private const string AppKey = "SOFTWARE\\AzureOpenAIChat";
// Write/Read Registry
public static void WriteAppInfo(string key, string value)
{
using (RegistryKey registryKey = Registry.CurrentUser.CreateSubKey(AppKey))
registryKey.SetValue(key, value);
}
public static string? ReadAppInfo(string key)
{
using (RegistryKey? registryKey = Registry.CurrentUser.OpenSubKey(AppKey))
if (registryKey == null)
return null;
else
return (string?)registryKey.GetValue(key);
}
}
}