Skip to content

Commit

Permalink
Default to LIVE if no launch channel set
Browse files Browse the repository at this point in the history
also fixed a bug with the font mod
  • Loading branch information
pizzaboxer committed Jul 15, 2023
1 parent 63ef907 commit 78869e5
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Bloxstrap/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
51 changes: 33 additions & 18 deletions Bloxstrap/ProtocolHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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('+'))
Expand All @@ -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;
Expand All @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock FontSize="14" Text="Deployment channel" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Choose which release channel Roblox should be downloaded from." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
<TextBlock FontSize="14" Text="Channel" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Choose which deployment channel Roblox should be downloaded from." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
<ComboBox Grid.Column="1" Margin="8,0,8,0" Padding="10,5,10,5" Width="200" IsEditable="True" ItemsSource="{Binding Channels, Mode=OneWay}" Text="{Binding SelectedChannel, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" KeyUp="ComboBox_KeyEnterUpdate" />
</Grid>
Expand Down

0 comments on commit 78869e5

Please sign in to comment.