From 0ffaec74ea40d359ae49676b60bc200217f3d747 Mon Sep 17 00:00:00 2001 From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com> Date: Wed, 16 Oct 2024 21:07:24 +0100 Subject: [PATCH 1/5] add studio command line parsing --- Bloxstrap/LaunchSettings.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Bloxstrap/LaunchSettings.cs b/Bloxstrap/LaunchSettings.cs index c700d9d..28a06ea 100644 --- a/Bloxstrap/LaunchSettings.cs +++ b/Bloxstrap/LaunchSettings.cs @@ -53,6 +53,10 @@ namespace Bloxstrap { const string LOG_IDENT = "LaunchSettings"; +#if DEBUG + App.Logger.WriteLine(LOG_IDENT, $"Launched with arguments: {string.Join(' ', args)}"); +#endif + Args = args; // build flag map @@ -112,7 +116,23 @@ namespace Bloxstrap { RobloxLaunchMode = LaunchMode.Studio; - // TODO: do this later + if (String.IsNullOrEmpty(data)) + return; + + if (data.StartsWith("roblox-studio:")) + { + RobloxLaunchArgs = data; + } + else if (data.StartsWith("roblox-studio-auth:")) + { + RobloxLaunchMode = LaunchMode.StudioAuth; + RobloxLaunchArgs = data; + } + else + { + // likely a local path + RobloxLaunchArgs = $"-task EditFile -localPlaceFile \"{data}\""; + } } } } From 72e2810a2d4db1284fb1bae48015ff8b03d5096a Mon Sep 17 00:00:00 2001 From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com> Date: Wed, 16 Oct 2024 21:20:14 +0100 Subject: [PATCH 2/5] add roblox studio option to launch dialog --- Bloxstrap/Enums/NextAction.cs | 3 ++- Bloxstrap/LaunchHandler.cs | 4 ++++ Bloxstrap/Resources/Strings.Designer.cs | 9 +++++++++ Bloxstrap/Resources/Strings.resx | 3 +++ Bloxstrap/UI/Elements/Dialogs/LaunchMenuDialog.xaml | 6 ++++++ Bloxstrap/UI/ViewModels/Dialogs/LaunchMenuViewModel.cs | 9 ++++++++- 6 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Bloxstrap/Enums/NextAction.cs b/Bloxstrap/Enums/NextAction.cs index cf804f7..607029e 100644 --- a/Bloxstrap/Enums/NextAction.cs +++ b/Bloxstrap/Enums/NextAction.cs @@ -4,6 +4,7 @@ { Terminate, LaunchSettings, - LaunchRoblox + LaunchRoblox, + LaunchRobloxStudio } } diff --git a/Bloxstrap/LaunchHandler.cs b/Bloxstrap/LaunchHandler.cs index cf7f165..a9a60ca 100644 --- a/Bloxstrap/LaunchHandler.cs +++ b/Bloxstrap/LaunchHandler.cs @@ -21,6 +21,10 @@ namespace Bloxstrap LaunchRoblox(LaunchMode.Player); break; + case NextAction.LaunchRobloxStudio: + LaunchRoblox(LaunchMode.Studio); + break; + default: App.Terminate(isUnfinishedInstall ? ErrorCode.ERROR_INSTALL_USEREXIT : ErrorCode.ERROR_SUCCESS); break; diff --git a/Bloxstrap/Resources/Strings.Designer.cs b/Bloxstrap/Resources/Strings.Designer.cs index cf5e6a6..a09298c 100644 --- a/Bloxstrap/Resources/Strings.Designer.cs +++ b/Bloxstrap/Resources/Strings.Designer.cs @@ -1612,6 +1612,15 @@ namespace Bloxstrap.Resources { } } + /// + /// Looks up a localized string similar to Launch Roblox Studio. + /// + public static string LaunchMenu_LaunchRobloxStudio { + get { + return ResourceManager.GetString("LaunchMenu.LaunchRobloxStudio", resourceCulture); + } + } + /// /// Looks up a localized string similar to See the Wiki for help. /// diff --git a/Bloxstrap/Resources/Strings.resx b/Bloxstrap/Resources/Strings.resx index 4d9d54b..c0ccf27 100644 --- a/Bloxstrap/Resources/Strings.resx +++ b/Bloxstrap/Resources/Strings.resx @@ -1236,4 +1236,7 @@ Would you like to enable test mode? Icons Name of the folder that gets created according to the "create shortcut icons" option. Ensure that it is a valid folder name. + + Launch Roblox Studio + \ No newline at end of file diff --git a/Bloxstrap/UI/Elements/Dialogs/LaunchMenuDialog.xaml b/Bloxstrap/UI/Elements/Dialogs/LaunchMenuDialog.xaml index 99e944c..5212c7c 100644 --- a/Bloxstrap/UI/Elements/Dialogs/LaunchMenuDialog.xaml +++ b/Bloxstrap/UI/Elements/Dialogs/LaunchMenuDialog.xaml @@ -64,6 +64,12 @@ + + + + + + diff --git a/Bloxstrap/UI/ViewModels/Dialogs/LaunchMenuViewModel.cs b/Bloxstrap/UI/ViewModels/Dialogs/LaunchMenuViewModel.cs index 25962a9..951f816 100644 --- a/Bloxstrap/UI/ViewModels/Dialogs/LaunchMenuViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Dialogs/LaunchMenuViewModel.cs @@ -1,4 +1,5 @@ -using System.Windows.Input; +using System.Windows; +using System.Windows.Input; using CommunityToolkit.Mvvm.Input; using Bloxstrap.UI.Elements.About; @@ -9,10 +10,14 @@ namespace Bloxstrap.UI.ViewModels.Installer { public string Version => string.Format(Strings.Menu_About_Version, App.Version); + public Visibility ShowRobloxStudioOption => String.IsNullOrEmpty(App.State.Prop.Studio.VersionGuid) ? Visibility.Collapsed : Visibility.Visible; + public ICommand LaunchSettingsCommand => new RelayCommand(LaunchSettings); public ICommand LaunchRobloxCommand => new RelayCommand(LaunchRoblox); + public ICommand LaunchRobloxStudioCommand => new RelayCommand(LaunchRobloxStudio); + public ICommand LaunchAboutCommand => new RelayCommand(LaunchAbout); public event EventHandler? CloseWindowRequest; @@ -21,6 +26,8 @@ namespace Bloxstrap.UI.ViewModels.Installer private void LaunchRoblox() => CloseWindowRequest?.Invoke(this, NextAction.LaunchRoblox); + private void LaunchRobloxStudio() => CloseWindowRequest?.Invoke(this, NextAction.LaunchRobloxStudio); + private void LaunchAbout() => new MainWindow().ShowDialog(); } } From dd7d870b903432ba825375f367bf98fc010bca89 Mon Sep 17 00:00:00 2001 From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com> Date: Wed, 16 Oct 2024 21:30:10 +0100 Subject: [PATCH 3/5] add studio shortcut option --- .../Settings/Pages/ShortcutsPage.xaml | 21 +++++++++++++++++-- .../ViewModels/Settings/ShortcutsViewModel.cs | 9 ++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Bloxstrap/UI/Elements/Settings/Pages/ShortcutsPage.xaml b/Bloxstrap/UI/Elements/Settings/Pages/ShortcutsPage.xaml index 38241ae..710b09a 100644 --- a/Bloxstrap/UI/Elements/Settings/Pages/ShortcutsPage.xaml +++ b/Bloxstrap/UI/Elements/Settings/Pages/ShortcutsPage.xaml @@ -49,14 +49,31 @@ + + + + + + - + - + + + + + diff --git a/Bloxstrap/UI/ViewModels/Settings/ShortcutsViewModel.cs b/Bloxstrap/UI/ViewModels/Settings/ShortcutsViewModel.cs index 413bb13..6e7f588 100644 --- a/Bloxstrap/UI/ViewModels/Settings/ShortcutsViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Settings/ShortcutsViewModel.cs @@ -1,16 +1,17 @@ -using Bloxstrap.Models.SettingTasks; -using Bloxstrap.Resources; - -namespace Bloxstrap.UI.ViewModels.Settings +namespace Bloxstrap.UI.ViewModels.Settings { public class ShortcutsViewModel : NotifyPropertyChangedViewModel { + public bool IsStudioOptionVisible => !String.IsNullOrEmpty(App.State.Prop.Studio.VersionGuid); + public ShortcutTask DesktopIconTask { get; } = new("Desktop", Paths.Desktop, $"{App.ProjectName}.lnk"); public ShortcutTask StartMenuIconTask { get; } = new("StartMenu", Paths.WindowsStartMenu, $"{App.ProjectName}.lnk"); public ShortcutTask PlayerIconTask { get; } = new("RobloxPlayer", Paths.Desktop, $"{Strings.LaunchMenu_LaunchRoblox}.lnk", "-player"); + public ShortcutTask StudioIconTask { get; } = new("RobloxStudio", Paths.Desktop, $"{Strings.LaunchMenu_LaunchRobloxStudio}.lnk", "-studio"); + public ShortcutTask SettingsIconTask { get; } = new("Settings", Paths.Desktop, $"{Strings.Menu_Title}.lnk", "-settings"); public ExtractIconsTask ExtractIconsTask { get; } = new(); From acc8b67c87c0a2ad1f5751ff86811a285f3f330e Mon Sep 17 00:00:00 2001 From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com> Date: Wed, 16 Oct 2024 21:32:11 +0100 Subject: [PATCH 4/5] add App.IsStudioVisible --- Bloxstrap/App.xaml.cs | 2 ++ Bloxstrap/Installer.cs | 4 ++-- Bloxstrap/UI/ViewModels/Dialogs/LaunchMenuViewModel.cs | 2 +- Bloxstrap/UI/ViewModels/Settings/ShortcutsViewModel.cs | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Bloxstrap/App.xaml.cs b/Bloxstrap/App.xaml.cs index ce40e07..cfc86ab 100644 --- a/Bloxstrap/App.xaml.cs +++ b/Bloxstrap/App.xaml.cs @@ -39,6 +39,8 @@ namespace Bloxstrap public static bool IsProductionBuild => IsActionBuild && BuildMetadata.CommitRef.StartsWith("tag", StringComparison.Ordinal); + public static bool IsStudioVisible => !String.IsNullOrEmpty(App.State.Prop.Studio.VersionGuid); + public static readonly MD5 MD5Provider = MD5.Create(); public static readonly Logger Logger = new(); diff --git a/Bloxstrap/Installer.cs b/Bloxstrap/Installer.cs index e9a4045..10bb781 100644 --- a/Bloxstrap/Installer.cs +++ b/Bloxstrap/Installer.cs @@ -91,7 +91,7 @@ namespace Bloxstrap App.Settings.Prop.EnableAnalytics = EnableAnalytics; - if (!String.IsNullOrEmpty(App.State.Prop.Studio.VersionGuid)) + if (App.IsStudioVisible) WindowsRegistry.RegisterStudio(); App.Settings.Save(); @@ -190,7 +190,7 @@ namespace Bloxstrap if (!String.IsNullOrEmpty(App.State.Prop.Player.VersionGuid)) processes.AddRange(Process.GetProcessesByName(App.RobloxPlayerAppName)); - if (!String.IsNullOrEmpty(App.State.Prop.Studio.VersionGuid)) + if (App.IsStudioVisible) processes.AddRange(Process.GetProcessesByName(App.RobloxStudioAppName)); // prompt to shutdown roblox if its currently running diff --git a/Bloxstrap/UI/ViewModels/Dialogs/LaunchMenuViewModel.cs b/Bloxstrap/UI/ViewModels/Dialogs/LaunchMenuViewModel.cs index 951f816..915923e 100644 --- a/Bloxstrap/UI/ViewModels/Dialogs/LaunchMenuViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Dialogs/LaunchMenuViewModel.cs @@ -10,7 +10,7 @@ namespace Bloxstrap.UI.ViewModels.Installer { public string Version => string.Format(Strings.Menu_About_Version, App.Version); - public Visibility ShowRobloxStudioOption => String.IsNullOrEmpty(App.State.Prop.Studio.VersionGuid) ? Visibility.Collapsed : Visibility.Visible; + public Visibility ShowRobloxStudioOption => App.IsStudioVisible ? Visibility.Visible : Visibility.Collapsed; public ICommand LaunchSettingsCommand => new RelayCommand(LaunchSettings); diff --git a/Bloxstrap/UI/ViewModels/Settings/ShortcutsViewModel.cs b/Bloxstrap/UI/ViewModels/Settings/ShortcutsViewModel.cs index 6e7f588..caef426 100644 --- a/Bloxstrap/UI/ViewModels/Settings/ShortcutsViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Settings/ShortcutsViewModel.cs @@ -2,7 +2,7 @@ { public class ShortcutsViewModel : NotifyPropertyChangedViewModel { - public bool IsStudioOptionVisible => !String.IsNullOrEmpty(App.State.Prop.Studio.VersionGuid); + public bool IsStudioOptionVisible => App.IsStudioVisible; public ShortcutTask DesktopIconTask { get; } = new("Desktop", Paths.Desktop, $"{App.ProjectName}.lnk"); From 14c5ca53ea55cb7a92e2aa413a62ae5b2533b12b Mon Sep 17 00:00:00 2001 From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com> Date: Wed, 16 Oct 2024 21:34:02 +0100 Subject: [PATCH 5/5] forgot to add launch menu studio visibility --- Bloxstrap/UI/Elements/Dialogs/LaunchMenuDialog.xaml | 2 +- Bloxstrap/UI/ViewModels/Dialogs/LaunchMenuViewModel.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Bloxstrap/UI/Elements/Dialogs/LaunchMenuDialog.xaml b/Bloxstrap/UI/Elements/Dialogs/LaunchMenuDialog.xaml index 5212c7c..58b8217 100644 --- a/Bloxstrap/UI/Elements/Dialogs/LaunchMenuDialog.xaml +++ b/Bloxstrap/UI/Elements/Dialogs/LaunchMenuDialog.xaml @@ -64,7 +64,7 @@ - + diff --git a/Bloxstrap/UI/ViewModels/Dialogs/LaunchMenuViewModel.cs b/Bloxstrap/UI/ViewModels/Dialogs/LaunchMenuViewModel.cs index 915923e..0c44b5d 100644 --- a/Bloxstrap/UI/ViewModels/Dialogs/LaunchMenuViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Dialogs/LaunchMenuViewModel.cs @@ -10,7 +10,7 @@ namespace Bloxstrap.UI.ViewModels.Installer { public string Version => string.Format(Strings.Menu_About_Version, App.Version); - public Visibility ShowRobloxStudioOption => App.IsStudioVisible ? Visibility.Visible : Visibility.Collapsed; + public Visibility RobloxStudioOptionVisibility => App.IsStudioVisible ? Visibility.Visible : Visibility.Collapsed; public ICommand LaunchSettingsCommand => new RelayCommand(LaunchSettings);