-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGuideConfig.cs
More file actions
54 lines (51 loc) · 2.13 KB
/
GuideConfig.cs
File metadata and controls
54 lines (51 loc) · 2.13 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;
using OccultWatcher.Guide.Properties;
namespace OccultWatcher.Guide
{
public static class GuideConfig
{
public static string GuidePath;
public static string GuideConfiguration;
public static string CommandLineArguments;
public static bool AlwaysNewInstance;
public static void LoadRegistryConfig()
{
using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\OccultWatcher"))
{
if (key != null)
{
GuidePath = (string)key.GetValue("GuidePath", Settings.Default.GuidePath);
GuideConfiguration = (string)key.GetValue("GuideConfiguration", Settings.Default.GuideConfiguration);
CommandLineArguments = (string)key.GetValue("CommandLineArguments", Settings.Default.CommandLineArguments);
AlwaysNewInstance = (string)key.GetValue("AlwaysNewInstance", Settings.Default.AlwaysNewInstance ? "true" : "false") == "true";
}
}
}
public static void SaveRegistryConfig()
{
using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\OccultWatcher"))
{
if (key != null)
{
key.SetValue("GuidePath", GuidePath);
key.SetValue("GuideConfiguration", GuideConfiguration);
key.SetValue("CommandLineArguments", CommandLineArguments);
key.SetValue("AlwaysNewInstance", AlwaysNewInstance ? "true" : "false");
}
else
{
Settings.Default.GuidePath = GuidePath;
Settings.Default.GuideConfiguration = GuideConfiguration;
Settings.Default.CommandLineArguments = CommandLineArguments;
Settings.Default.AlwaysNewInstance = AlwaysNewInstance;
Settings.Default.Save();
}
}
}
}
}