This repository has been archived by the owner on May 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSettings.cs
40 lines (34 loc) · 1.66 KB
/
Settings.cs
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
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OS_Game_Launcher
{
public static class Settings
{
public readonly static Dictionary<string, string> SettingsIndentifier = new Dictionary<string, string>() {
{ "DGIP", "DefaultGameInstallationPath" },
{ "CDS", "CreateDesktopShortcuts" },
{ "SDN", "SendDesktopNotifications" }
};
public static bool SendDesktopNotifications = true;
public static bool CreateDesktopShortcuts = true;
public static string DefaultGameInstallationPath = null;
public static void Load()
{
var rootKey = Utils.RegistryOpenCreateKey(Registry.CurrentUser, Properties.Settings.Default.regestryPath);
DefaultGameInstallationPath = (string)Utils.RegistryGetSet(rootKey, SettingsIndentifier["DGIP"], Utils.GetDefaultInstallationPath());
CreateDesktopShortcuts = Convert.ToBoolean(Utils.RegistryGetSet(rootKey, SettingsIndentifier["CDS"], true));
SendDesktopNotifications = Convert.ToBoolean(Utils.RegistryGetSet(rootKey, SettingsIndentifier["SDN"], true));
}
public static void Save()
{
var rootKey = Utils.RegistryOpenCreateKey(Registry.CurrentUser, Properties.Settings.Default.regestryPath);
rootKey.SetValue(Settings.SettingsIndentifier["DGIP"], DefaultGameInstallationPath);
rootKey.SetValue(Settings.SettingsIndentifier["CDS"], CreateDesktopShortcuts);
rootKey.SetValue(Settings.SettingsIndentifier["SDN"], SendDesktopNotifications);
}
}
}