mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
make register function cleaner
This commit is contained in:
parent
ba031a645e
commit
9dc836f8f3
@ -116,9 +116,10 @@ namespace Bloxstrap
|
|||||||
public static void Register(string key, string name, string handler)
|
public static void Register(string key, string name, string handler)
|
||||||
{
|
{
|
||||||
string handlerArgs = $"\"{handler}\" %1";
|
string handlerArgs = $"\"{handler}\" %1";
|
||||||
RegistryKey uriKey = Registry.CurrentUser.CreateSubKey($@"Software\Classes\{key}");
|
|
||||||
RegistryKey uriIconKey = uriKey.CreateSubKey("DefaultIcon");
|
using RegistryKey uriKey = Registry.CurrentUser.CreateSubKey($@"Software\Classes\{key}");
|
||||||
RegistryKey uriCommandKey = uriKey.CreateSubKey(@"shell\open\command");
|
using RegistryKey uriIconKey = uriKey.CreateSubKey("DefaultIcon");
|
||||||
|
using RegistryKey uriCommandKey = uriKey.CreateSubKey(@"shell\open\command");
|
||||||
|
|
||||||
if (uriKey.GetValue("") is null)
|
if (uriKey.GetValue("") is null)
|
||||||
{
|
{
|
||||||
@ -126,15 +127,11 @@ namespace Bloxstrap
|
|||||||
uriKey.SetValue("URL Protocol", "");
|
uriKey.SetValue("URL Protocol", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((string?)uriCommandKey.GetValue("") != handlerArgs)
|
if (uriCommandKey.GetValue("") as string != handlerArgs)
|
||||||
{
|
{
|
||||||
uriIconKey.SetValue("", handler);
|
uriIconKey.SetValue("", handler);
|
||||||
uriCommandKey.SetValue("", handlerArgs);
|
uriCommandKey.SetValue("", handlerArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
uriKey.Close();
|
|
||||||
uriIconKey.Close();
|
|
||||||
uriCommandKey.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RegisterRobloxPlace(string handler)
|
public static void RegisterRobloxPlace(string handler)
|
||||||
|
Loading…
Reference in New Issue
Block a user