mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
register rbxl and rbxlx extensions
This commit is contained in:
parent
c5c5ff96f3
commit
dc65f628d8
@ -510,6 +510,10 @@ namespace Bloxstrap
|
||||
ProtocolHandler.Register("roblox-studio", "Roblox", Paths.Application);
|
||||
ProtocolHandler.Register("roblox-studio-auth", "Roblox", Paths.Application);
|
||||
|
||||
ProtocolHandler.RegisterRobloxPlace(Paths.Application);
|
||||
ProtocolHandler.RegisterExtension(".rbxl");
|
||||
ProtocolHandler.RegisterExtension(".rbxlx");
|
||||
|
||||
if (Environment.ProcessPath is not null && Environment.ProcessPath != Paths.Application)
|
||||
{
|
||||
// in case the user is reinstalling
|
||||
@ -711,12 +715,18 @@ namespace Bloxstrap
|
||||
|
||||
ProtocolHandler.Unregister("roblox-studio");
|
||||
ProtocolHandler.Unregister("roblox-studio-auth");
|
||||
|
||||
ProtocolHandler.Unregister("Roblox.Place");
|
||||
ProtocolHandler.Unregister(".rbxl");
|
||||
ProtocolHandler.Unregister(".rbxlx");
|
||||
}
|
||||
else
|
||||
{
|
||||
string studioLocation = (string?)studioBootstrapperKey.GetValue("InstallLocation") + "RobloxStudioBeta.exe"; // points to studio exe instead of bootstrapper
|
||||
ProtocolHandler.Register("roblox-studio", "Roblox", studioLocation);
|
||||
ProtocolHandler.Register("roblox-studio-auth", "Roblox", studioLocation);
|
||||
|
||||
ProtocolHandler.RegisterRobloxPlace(studioLocation);
|
||||
}
|
||||
|
||||
// if the folder we're installed to does not end with "Bloxstrap", we're installed to a user-selected folder
|
||||
|
@ -7,6 +7,8 @@ namespace Bloxstrap
|
||||
{
|
||||
static class ProtocolHandler
|
||||
{
|
||||
private const string RobloxPlaceKey = "Roblox.Place";
|
||||
|
||||
// map uri keys to command line args
|
||||
private static readonly IReadOnlyDictionary<string, string> UriKeyArgMap = new Dictionary<string, string>()
|
||||
{
|
||||
@ -135,6 +137,39 @@ namespace Bloxstrap
|
||||
uriCommandKey.Close();
|
||||
}
|
||||
|
||||
public static void RegisterRobloxPlace(string handler)
|
||||
{
|
||||
const string keyValue = "Roblox Place";
|
||||
string handlerArgs = $"\"{handler}\" -ide \"%1\"";
|
||||
string iconValue = $"{handler},0";
|
||||
|
||||
using RegistryKey uriKey = Registry.CurrentUser.CreateSubKey(@"Software\Classes\" + RobloxPlaceKey);
|
||||
using RegistryKey uriIconKey = uriKey.CreateSubKey("DefaultIcon");
|
||||
using RegistryKey uriOpenKey = uriKey.CreateSubKey(@"shell\Open");
|
||||
using RegistryKey uriCommandKey = uriOpenKey.CreateSubKey(@"command");
|
||||
|
||||
if (uriKey.GetValue("") as string != keyValue)
|
||||
uriKey.SetValue("", keyValue);
|
||||
|
||||
if (uriCommandKey.GetValue("") as string != handlerArgs)
|
||||
uriCommandKey.SetValue("", handlerArgs);
|
||||
|
||||
if (uriOpenKey.GetValue("") as string != "Open")
|
||||
uriOpenKey.SetValue("", "Open");
|
||||
|
||||
if (uriIconKey.GetValue("") as string != iconValue)
|
||||
uriIconKey.SetValue("", iconValue);
|
||||
}
|
||||
|
||||
public static void RegisterExtension(string key)
|
||||
{
|
||||
using RegistryKey uriKey = Registry.CurrentUser.CreateSubKey($@"Software\Classes\{key}");
|
||||
uriKey.CreateSubKey(RobloxPlaceKey + @"\ShellNew");
|
||||
|
||||
if (uriKey.GetValue("") as string != RobloxPlaceKey)
|
||||
uriKey.SetValue("", RobloxPlaceKey);
|
||||
}
|
||||
|
||||
public static void Unregister(string key)
|
||||
{
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user