Merge pull request #3189 from bloxstraplabs/feature/improve-studio-support

Improve studio support
This commit is contained in:
Matt 2024-12-04 17:41:31 +00:00 committed by GitHub
commit 729ee2bbf4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 81 additions and 11 deletions

View File

@ -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();

View File

@ -4,6 +4,7 @@
{
Terminate,
LaunchSettings,
LaunchRoblox
LaunchRoblox,
LaunchRobloxStudio
}
}

View File

@ -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

View File

@ -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;

View File

@ -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}\"";
}
}
}
}

View File

@ -1644,6 +1644,15 @@ namespace Bloxstrap.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Launch Roblox Studio.
/// </summary>
public static string LaunchMenu_LaunchRobloxStudio {
get {
return ResourceManager.GetString("LaunchMenu.LaunchRobloxStudio", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to See the Wiki for help.
/// </summary>

View File

@ -1237,6 +1237,9 @@ Would you like to enable test mode?</value>
<value>Icons</value>
<comment>Name of the folder that gets created according to the "create shortcut icons" option. Ensure that it is a valid folder name.</comment>
</data>
<data name="LaunchMenu.LaunchRobloxStudio" xml:space="preserve">
<value>Launch Roblox Studio</value>
</data>
<data name="Dialog.Exception.Version" xml:space="preserve">
<value>Version {0}</value>
</data>

View File

@ -64,6 +64,12 @@
</StackPanel>
</ui:CardAction>
<ui:CardAction Margin="0,8,0,0" Icon="ArrowRight12" Visibility="{Binding RobloxStudioOptionVisibility, Mode=OneTime}" Command="{Binding LaunchRobloxStudioCommand, Mode=OneTime}">
<StackPanel>
<TextBlock FontSize="14" Text="{x:Static resources:Strings.LaunchMenu_LaunchRobloxStudio}" />
</StackPanel>
</ui:CardAction>
<ui:CardAction Margin="0,8,0,0" TabIndex="1" Icon="Settings28" Command="{Binding LaunchSettingsCommand, Mode=OneTime}">
<StackPanel>
<TextBlock FontSize="14" Text="{x:Static resources:Strings.LaunchMenu_ConfigureSettings}" />

View File

@ -49,14 +49,31 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<!-- https://stackoverflow.com/a/51967350 -->
<ColumnDefinition>
<ColumnDefinition.Style>
<Style TargetType="ColumnDefinition">
<Setter Property="Width" Value="*" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsStudioOptionVisible}" Value="False">
<Setter Property="Width" Value="0" />
</DataTrigger>
</Style.Triggers>
</Style>
</ColumnDefinition.Style>
</ColumnDefinition>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<controls:OptionControl Grid.Column="0" Margin="0,0,4,0" Header="{x:Static resources:Strings.LaunchMenu_LaunchRoblox}">
<controls:OptionControl Grid.Column="0" Margin="0,0,2,0" Header="{x:Static resources:Strings.LaunchMenu_LaunchRoblox}">
<ui:ToggleSwitch IsChecked="{Binding PlayerIconTask.NewState, Mode=TwoWay}" />
</controls:OptionControl>
<controls:OptionControl Grid.Column="1" Margin="4,0,0,0" Header="{x:Static resources:Strings.Menu_Title}">
<controls:OptionControl Grid.Column="1" Margin="2,0,2,0" Header="{x:Static resources:Strings.LaunchMenu_LaunchRobloxStudio}">
<ui:ToggleSwitch IsChecked="{Binding StudioIconTask.NewState, Mode=TwoWay}" />
</controls:OptionControl>
<controls:OptionControl Grid.Column="2" Margin="2,0,0,0" Header="{x:Static resources:Strings.Menu_Title}">
<ui:ToggleSwitch IsChecked="{Binding SettingsIconTask.NewState, Mode=TwoWay}" />
</controls:OptionControl>
</Grid>

View File

@ -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<NextAction>? 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();
}
}

View File

@ -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();