From 78869e5e7e21f1633ac905de239807caeecbd5e5 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Sat, 15 Jul 2023 12:59:18 +0100 Subject: [PATCH] Default to LIVE if no launch channel set also fixed a bug with the font mod --- Bloxstrap/Bootstrapper.cs | 2 +- Bloxstrap/ProtocolHandler.cs | 51 ++++++++++++------- .../UI/Elements/Menu/Pages/BehaviourPage.xaml | 4 +- 3 files changed, 36 insertions(+), 21 deletions(-) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index cc64143e..8f6c9756 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -1069,7 +1069,7 @@ private async Task ApplyModifications() App.Logger.WriteLine("[Bootstrapper::ApplyModifications] End font check"); } - else + else if (Directory.Exists(modFontFamiliesFolder)) { Directory.Delete(modFontFamiliesFolder, true); } diff --git a/Bloxstrap/ProtocolHandler.cs b/Bloxstrap/ProtocolHandler.cs index ce1a4ace..4d4c58c1 100644 --- a/Bloxstrap/ProtocolHandler.cs +++ b/Bloxstrap/ProtocolHandler.cs @@ -32,6 +32,8 @@ public static string ParseUri(string protocol) string[] keyvalPair; string key; string val; + bool channelArgPresent = false; + StringBuilder commandLine = new(); foreach (var parameter in protocol.Split('+')) @@ -56,25 +58,10 @@ public static string ParseUri(string protocol) if (key == "launchtime") val = "LAUNCHTIMEPLACEHOLDER"; - if (key == "channel") + if (key == "channel" && !String.IsNullOrEmpty(val)) { - if (val.ToLowerInvariant() != App.Settings.Prop.Channel.ToLowerInvariant() && App.Settings.Prop.ChannelChangeMode != ChannelChangeMode.Ignore) - { - MessageBoxResult result = App.Settings.Prop.ChannelChangeMode == ChannelChangeMode.Automatic - ? MessageBoxResult.Yes - : Controls.ShowMessageBox( - $"Roblox is attempting to set your channel to {val}, however your current preferred channel is {App.Settings.Prop.Channel}.\n\n" + - $"Would you like to switch channels from {App.Settings.Prop.Channel} to {val}?", - MessageBoxImage.Question, - MessageBoxButton.YesNo - ); - - if (result == MessageBoxResult.Yes) - { - App.Logger.WriteLine($"[Protocol::ParseUri] Changed Roblox build channel from {App.Settings.Prop.Channel} to {val}"); - App.Settings.Prop.Channel = val; - } - } + channelArgPresent = true; + ChangeChannel(val); // we'll set the arg when launching continue; @@ -83,9 +70,37 @@ public static string ParseUri(string protocol) commandLine.Append(UriKeyArgMap[key] + val + " "); } + if (!channelArgPresent) + ChangeChannel(RobloxDeployment.DefaultChannel); + return commandLine.ToString(); } + public static void ChangeChannel(string channel) + { + if (channel.ToLowerInvariant() == App.Settings.Prop.Channel.ToLowerInvariant()) + return; + + if (App.Settings.Prop.ChannelChangeMode == ChannelChangeMode.Ignore) + return; + + if (App.Settings.Prop.ChannelChangeMode != ChannelChangeMode.Automatic) + { + MessageBoxResult result = Controls.ShowMessageBox( + $"Roblox is attempting to set your channel to {channel}, however your current preferred channel is {App.Settings.Prop.Channel}.\n\n" + + $"Would you like to switch channels from {App.Settings.Prop.Channel} to {channel}?", + MessageBoxImage.Question, + MessageBoxButton.YesNo + ); + + if (result != MessageBoxResult.Yes) + return; + } + + App.Logger.WriteLine($"[Protocol::ParseUri] Changed Roblox build channel from {App.Settings.Prop.Channel} to {channel}"); + App.Settings.Prop.Channel = channel; + } + public static void Register(string key, string name, string handler) { string handlerArgs = $"\"{handler}\" %1"; diff --git a/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml b/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml index 9f28d66b..9d118b28 100644 --- a/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml +++ b/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml @@ -39,8 +39,8 @@ - - + +