2#pragma warning disable CA1416
5namespace Game.Managers {
6 static class WindowsRegisterManager {
7 public static string SurvivalcraftPath => $
"{ModsManager.ExternalPath}Survivalcraft.exe";
9 public static void RegisterFileType(
string keyName,
string keyValue,
string extension) {
15 RegistryKey isExCommand = Registry.ClassesRoot.OpenSubKey(keyName);
16 if (isExCommand ==
null) {
20 if (isExCommand.GetValue(
"Create")?.ToString() == SurvivalcraftPath) {
24 Registry.ClassesRoot.DeleteSubKeyTree(keyName);
37 if (SurvivalcraftPath ==
null) {
40 RegistryKey key = Registry.ClassesRoot.CreateSubKey(keyName);
44 key.SetValue(
"Create", SurvivalcraftPath);
45 RegistryKey keyico = key.CreateSubKey(
"DefaultIcon");
49 keyico.SetValue(
"", $
"{SurvivalcraftPath},0");
50 key.SetValue(
"", keyValue);
51 key = key.CreateSubKey(
"Shell");
55 key = key.CreateSubKey(
"Open");
59 key = key.CreateSubKey(
"Command");
65 key.SetValue(
"",
$@"{SurvivalcraftPath} %1/");
69 key = Registry.ClassesRoot.CreateSubKey(keyName);
73 key.SetValue(
"", keyValue);