launcher/URI_Maker.cs

44 lines
1.4 KiB
C#

using System;
using System.Windows.Forms;
using System.Security.Permissions;
using Microsoft.Win32;
using System.Text;
using System.Net;
using System.IO;
namespace ARCHBLOXProtocol
{
class SharedVariables
{
public static string Arguments = "";
};
internal static class ARCHBLOXURIProtocol
{
private static RegistryKey softwareClasses = Registry.CurrentUser.OpenSubKey("Software").OpenSubKey("Classes", true);
internal static void Register()
{
// credit to p0s0 for helping me with this
if (softwareClasses.OpenSubKey("archblox") == null) {} else { softwareClasses.DeleteSubKeyTree("archblox"); }
RegistryKey key = softwareClasses.CreateSubKey("archblox", true);
key.SetValue("", "URL: archblox Protocol");
key.SetValue("URL Protocol", "");
RegistryKey key1 = key.CreateSubKey("DefaultIcon", true);
key1.SetValue("", ARCHBLOXLauncherGUI.Extensions.GetExecutablePath());
RegistryKey key2 = key.CreateSubKey("shell", true);
RegistryKey key3 = key2.CreateSubKey("open", true);
RegistryKey key4 = key3.CreateSubKey("command", true);
key4.SetValue("", "\"" + ARCHBLOXLauncherGUI.Extensions.GetExecutablePath() + "\" %1");
key.Close();
key1.Close();
key2.Close();
key3.Close();
key4.Close();
}
}
}