From a3033474b8da49d4c03b81a3bd75d197ff996e6e Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Tue, 11 Jun 2024 19:06:42 +0100 Subject: [PATCH] Build: toggling of studio functionality --- Bloxstrap/Bootstrapper.cs | 16 ++++++++++++++-- Bloxstrap/LaunchSettings.cs | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 9b4be55..8755d28 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -517,12 +517,14 @@ namespace Bloxstrap ProtocolHandler.Register("roblox", "Roblox", Paths.Application); ProtocolHandler.Register("roblox-player", "Roblox", Paths.Application); +#if STUDIO_FEATURES 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"); +#endif if (Environment.ProcessPath is not null && Environment.ProcessPath != Paths.Application) { @@ -556,7 +558,9 @@ namespace Bloxstrap Utility.Shortcut.Create(Paths.Application, "", Path.Combine(Paths.StartMenu, "Play Roblox.lnk")); Utility.Shortcut.Create(Paths.Application, "-menu", Path.Combine(Paths.StartMenu, $"{App.ProjectName} Menu.lnk")); +#if STUDIO_FEATURES Utility.Shortcut.Create(Paths.Application, "-ide", Path.Combine(Paths.StartMenu, $"Roblox Studio ({App.ProjectName}).lnk")); +#endif if (App.Settings.Prop.CreateDesktopIcon) { @@ -686,11 +690,13 @@ namespace Bloxstrap process.Close(); } +#if STUDIO_FEATURES foreach (Process process in Process.GetProcessesByName(App.RobloxStudioAppName)) { process.Kill(); process.Close(); } +#endif } catch (Exception ex) { @@ -725,6 +731,7 @@ namespace Bloxstrap ProtocolHandler.Register("roblox-player", "Roblox", bootstrapperLocation); } +#if STUDIO_FEATURES using RegistryKey? studioBootstrapperKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall\roblox-studio"); if (studioBootstrapperKey is null) { @@ -745,6 +752,7 @@ namespace Bloxstrap ProtocolHandler.RegisterRobloxPlace(studioLocation); } +#endif // if the folder we're installed to does not end with "Bloxstrap", we're installed to a user-selected folder // in which case, chances are they chose to install to somewhere they didn't really mean to (prior to the added warning in 2.4.0) @@ -821,7 +829,7 @@ namespace Bloxstrap Dialog?.ShowSuccess(Resources.Strings.Bootstrapper_SuccessfullyUninstalled, callback); } - #endregion +#endregion #region Roblox Install private async Task InstallLatestVersion() @@ -948,7 +956,11 @@ namespace Bloxstrap // delete any old version folders // we only do this if roblox isnt running just in case an update happened // while they were launching a second instance or something idk +#if STUDIO_FEATURES if (!Process.GetProcessesByName(App.RobloxPlayerAppName).Any() && !Process.GetProcessesByName(App.RobloxStudioAppName).Any()) +#else + if (!Process.GetProcessesByName(App.RobloxPlayerAppName).Any()) +#endif { foreach (DirectoryInfo dir in new DirectoryInfo(Paths.Versions).GetDirectories()) { @@ -1510,6 +1522,6 @@ namespace Bloxstrap string extractionPath = Path.Combine(_versionFolder, _packageDirectories[package.Name], entry.FullName); entry.ExtractToFile(extractionPath, true); } - #endregion +#endregion } } diff --git a/Bloxstrap/LaunchSettings.cs b/Bloxstrap/LaunchSettings.cs index eed637d..92b68bb 100644 --- a/Bloxstrap/LaunchSettings.cs +++ b/Bloxstrap/LaunchSettings.cs @@ -91,6 +91,7 @@ namespace Bloxstrap RobloxLaunchMode = LaunchMode.Player; } +#if STUDIO_FEATURES else if (arg.StartsWith("roblox-studio:")) { RobloxLaunchArgs = ProtocolHandler.ParseUri(arg); @@ -121,6 +122,7 @@ namespace Bloxstrap RobloxLaunchArgs = $"-task EditFile -localPlaceFile \"{pathArg}\""; } } +#endif } private void Parse()