diff --git a/Bloxstrap/App.xaml.cs b/Bloxstrap/App.xaml.cs index 5dced57..4fd8b79 100644 --- a/Bloxstrap/App.xaml.cs +++ b/Bloxstrap/App.xaml.cs @@ -42,6 +42,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/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/Installer.cs b/Bloxstrap/Installer.cs index e5fbf39..ca1fa04 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/LaunchHandler.cs b/Bloxstrap/LaunchHandler.cs index cfd1a29..f76629b 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/LaunchSettings.cs b/Bloxstrap/LaunchSettings.cs index 62c87f5..3790148 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 @@ -125,7 +129,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}\""; + } } } } diff --git a/Bloxstrap/Resources/Strings.Designer.cs b/Bloxstrap/Resources/Strings.Designer.cs index f50f201..afa8196 100644 --- a/Bloxstrap/Resources/Strings.Designer.cs +++ b/Bloxstrap/Resources/Strings.Designer.cs @@ -1644,6 +1644,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 7600e06..fe71c2a 100644 --- a/Bloxstrap/Resources/Strings.resx +++ b/Bloxstrap/Resources/Strings.resx @@ -1237,6 +1237,9 @@ 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 + Version {0} diff --git a/Bloxstrap/UI/Elements/Dialogs/LaunchMenuDialog.xaml b/Bloxstrap/UI/Elements/Dialogs/LaunchMenuDialog.xaml index 17d0fff..f73790f 100644 --- a/Bloxstrap/UI/Elements/Dialogs/LaunchMenuDialog.xaml +++ b/Bloxstrap/UI/Elements/Dialogs/LaunchMenuDialog.xaml @@ -64,6 +64,12 @@ + + + + + + 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/Dialogs/LaunchMenuViewModel.cs b/Bloxstrap/UI/ViewModels/Dialogs/LaunchMenuViewModel.cs index 25962a9..0c44b5d 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 RobloxStudioOptionVisibility => App.IsStudioVisible ? Visibility.Visible : Visibility.Collapsed; + 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(); } } diff --git a/Bloxstrap/UI/ViewModels/Settings/ShortcutsViewModel.cs b/Bloxstrap/UI/ViewModels/Settings/ShortcutsViewModel.cs index 413bb13..caef426 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 => App.IsStudioVisible; + 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();