mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
strip down channel functions to stock behaviour
This commit is contained in:
parent
dc842f90b9
commit
f742d4b45b
@ -126,6 +126,22 @@ namespace Bloxstrap
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
|
||||
using (var checker = new InstallChecker())
|
||||
{
|
||||
checker.Check();
|
||||
}
|
||||
|
||||
Paths.Initialize(BaseDirectory);
|
||||
|
||||
// we shouldn't save settings on the first run until the first installation is finished,
|
||||
// just in case the user decides to cancel the install
|
||||
if (!IsFirstRun)
|
||||
{
|
||||
Settings.Load();
|
||||
State.Load();
|
||||
FastFlags.Load();
|
||||
}
|
||||
|
||||
LaunchSettings = new LaunchSettings(e.Args);
|
||||
|
||||
HttpClient.Timeout = TimeSpan.FromSeconds(30);
|
||||
@ -135,13 +151,6 @@ namespace Bloxstrap
|
||||
// REMOVE WHEN LARGER REFACTORING IS DONE
|
||||
await RobloxDeployment.InitializeConnectivity();
|
||||
|
||||
using (var checker = new InstallChecker())
|
||||
{
|
||||
checker.Check();
|
||||
}
|
||||
|
||||
Paths.Initialize(BaseDirectory);
|
||||
|
||||
// disallow running as administrator except for uninstallation
|
||||
if (Utilities.IsAdministrator && !LaunchSettings.IsUninstall)
|
||||
{
|
||||
@ -168,10 +177,6 @@ namespace Bloxstrap
|
||||
Logger.WriteLine(LOG_IDENT, "Possible duplicate launch detected, terminating.");
|
||||
Terminate();
|
||||
}
|
||||
|
||||
Settings.Load();
|
||||
State.Load();
|
||||
FastFlags.Load();
|
||||
}
|
||||
|
||||
if (!LaunchSettings.IsUninstall && !LaunchSettings.IsMenuLaunch)
|
||||
|
@ -257,25 +257,10 @@ namespace Bloxstrap
|
||||
|
||||
if (clientVersion.IsBehindDefaultChannel)
|
||||
{
|
||||
MessageBoxResult action = App.Settings.Prop.ChannelChangeMode switch
|
||||
{
|
||||
ChannelChangeMode.Prompt => Frontend.ShowMessageBox(
|
||||
string.Format(Resources.Strings.Bootstrapper_ChannelOutOfDate, App.Settings.Prop.Channel, RobloxDeployment.DefaultChannel),
|
||||
MessageBoxImage.Warning,
|
||||
MessageBoxButton.YesNo
|
||||
),
|
||||
ChannelChangeMode.Automatic => MessageBoxResult.Yes,
|
||||
ChannelChangeMode.Ignore => MessageBoxResult.No,
|
||||
_ => MessageBoxResult.None
|
||||
};
|
||||
App.Logger.WriteLine(LOG_IDENT, $"Changed Roblox channel from {App.Settings.Prop.Channel} to {RobloxDeployment.DefaultChannel}");
|
||||
|
||||
if (action == MessageBoxResult.Yes)
|
||||
{
|
||||
App.Logger.WriteLine("Bootstrapper::CheckLatestVersion", $"Changed Roblox channel from {App.Settings.Prop.Channel} to {RobloxDeployment.DefaultChannel}");
|
||||
|
||||
App.Settings.Prop.Channel = RobloxDeployment.DefaultChannel;
|
||||
clientVersion = await RobloxDeployment.GetInfo(App.Settings.Prop.Channel, binaryType: binaryType);
|
||||
}
|
||||
App.Settings.Prop.Channel = RobloxDeployment.DefaultChannel;
|
||||
clientVersion = await RobloxDeployment.GetInfo(App.Settings.Prop.Channel, binaryType: binaryType);
|
||||
}
|
||||
|
||||
_latestVersionGuid = clientVersion.VersionGuid;
|
||||
|
@ -1,9 +0,0 @@
|
||||
namespace Bloxstrap.Enums
|
||||
{
|
||||
public enum ChannelChangeMode
|
||||
{
|
||||
Automatic,
|
||||
Prompt,
|
||||
Ignore
|
||||
}
|
||||
}
|
@ -20,7 +20,6 @@ namespace Bloxstrap.Models
|
||||
|
||||
// channel configuration
|
||||
public string Channel { get; set; } = RobloxDeployment.DefaultChannel;
|
||||
public ChannelChangeMode ChannelChangeMode { get; set; } = ChannelChangeMode.Automatic;
|
||||
|
||||
// integration configuration
|
||||
public bool EnableActivityTracking { get; set; } = true;
|
||||
|
@ -51,26 +51,16 @@ namespace Bloxstrap
|
||||
if (channel.ToLowerInvariant() == App.Settings.Prop.Channel.ToLowerInvariant())
|
||||
return;
|
||||
|
||||
if (App.Settings.Prop.ChannelChangeMode == ChannelChangeMode.Ignore)
|
||||
return;
|
||||
|
||||
if (App.Settings.Prop.ChannelChangeMode != ChannelChangeMode.Automatic)
|
||||
// don't change if roblox is already running
|
||||
if (Process.GetProcessesByName("RobloxPlayerBeta").Any())
|
||||
{
|
||||
if (channel == App.State.Prop.LastEnrolledChannel)
|
||||
return;
|
||||
|
||||
MessageBoxResult result = Frontend.ShowMessageBox(
|
||||
string.Format(Resources.Strings.ProtocolHandler_RobloxSwitchedChannel, channel, App.Settings.Prop.Channel),
|
||||
MessageBoxImage.Question,
|
||||
MessageBoxButton.YesNo
|
||||
);
|
||||
|
||||
if (result != MessageBoxResult.Yes)
|
||||
return;
|
||||
App.Logger.WriteLine("ProtocolHandler::ChangeChannel", $"Ignored channel change from {App.Settings.Prop.Channel} to {channel} because Roblox is already running");
|
||||
}
|
||||
else
|
||||
{
|
||||
App.Logger.WriteLine("ProtocolHandler::ChangeChannel", $"Changed Roblox channel from {App.Settings.Prop.Channel} to {channel}");
|
||||
App.Settings.Prop.Channel = channel;
|
||||
}
|
||||
|
||||
App.Logger.WriteLine("Protocol::ParseUri", $"Changed Roblox channel from {App.Settings.Prop.Channel} to {channel}");
|
||||
App.Settings.Prop.Channel = channel;
|
||||
}
|
||||
|
||||
public static void EnrollChannel(string channel)
|
||||
|
@ -29,131 +29,6 @@
|
||||
<ui:ToggleSwitch IsChecked="{Binding UpdateCheckingEnabled, Mode=TwoWay}" />
|
||||
</controls:OptionControl>
|
||||
|
||||
<ui:CardExpander Margin="0,8,0,0" IsExpanded="True">
|
||||
<ui:CardExpander.Header>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock FontSize="14" Text="{x:Static resources:Strings.Menu_Behaviour_Channel_Title}" />
|
||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="{x:Static resources:Strings.Menu_Behaviour_Channel_Description}" Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
</StackPanel>
|
||||
<ui:TextBox Grid.Column="1" Margin="8,0,8,0" Padding="10,5,10,5" Width="200" Text="{Binding SelectedChannel, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Delay=250}" />
|
||||
</Grid>
|
||||
</ui:CardExpander.Header>
|
||||
|
||||
<StackPanel>
|
||||
<Grid Margin="0,0,4,0">
|
||||
<Grid.Style>
|
||||
<Style TargetType="Grid">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ChannelDeployInfo}" Value="{x:Null}">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Grid.Style>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Margin="0,0,16,8" VerticalAlignment="Center" Text="{x:Static resources:Strings.Menu_Behaviour_Channel_Version}" />
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Foreground="{DynamicResource TextFillColorTertiaryBrush}" Text="{Binding ChannelDeployInfo.Version, Mode=OneWay}" />
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Margin="0,0,16,8" VerticalAlignment="Center" Text="{x:Static resources:Strings.Menu_Behaviour_Channel_VersionGuid}" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Foreground="{DynamicResource TextFillColorTertiaryBrush}" Text="{Binding ChannelDeployInfo.VersionGuid, Mode=OneWay}" />
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Margin="0,0,16,0" VerticalAlignment="Center" Text="{x:Static resources:Strings.Menu_Behaviour_Channel_Deployed}" />
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" Foreground="{DynamicResource TextFillColorTertiaryBrush}" Text="{Binding ChannelDeployInfo.Timestamp, Mode=OneWay}" />
|
||||
|
||||
<StackPanel Grid.Row="3" Grid.ColumnSpan="2" Margin="0,16,0,0" Orientation="Horizontal">
|
||||
<StackPanel.Style>
|
||||
<Style TargetType="StackPanel">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ShowChannelWarning, Mode=OneWay}" Value="True">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</StackPanel.Style>
|
||||
<Image Grid.Column="0" Width="24" Height="24" RenderOptions.BitmapScalingMode="HighQuality" Source="pack://application:,,,/Resources/MessageBox/Warning.png" />
|
||||
<TextBlock Margin="8,0,0,0" VerticalAlignment="Center" Text="{x:Static resources:Strings.Menu_Behaviour_Channel_Outdated}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Grid Column="0">
|
||||
<Grid.Style>
|
||||
<Style TargetType="Grid">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ChannelDeployInfo}" Value="{x:Null}">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Grid.Style>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<ui:ProgressRing Grid.Column="0" Margin="6" IsIndeterminate="True">
|
||||
<ui:ProgressRing.Style>
|
||||
<Style TargetType="ui:ProgressRing" BasedOn="{StaticResource {x:Type ui:ProgressRing}}">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ShowLoadingError, Mode=OneWay}" Value="True">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ui:ProgressRing.Style>
|
||||
</ui:ProgressRing>
|
||||
|
||||
<Image Grid.Column="0" Margin="6" Width="60" Height="60" RenderOptions.BitmapScalingMode="HighQuality" Source="pack://application:,,,/Resources/MessageBox/Error.png">
|
||||
<Image.Style>
|
||||
<Style TargetType="Image">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ShowLoadingError, Mode=OneWay}" Value="True">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Image.Style>
|
||||
</Image>
|
||||
|
||||
<TextBlock Grid.Column="1" Margin="16" VerticalAlignment="Center" Text="{Binding ChannelInfoLoadingText, Mode=OneWay}" TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ui:CardExpander>
|
||||
|
||||
<controls:OptionControl
|
||||
Header="{x:Static resources:Strings.Menu_Behaviour_AutoChannelChange_Title}"
|
||||
Description="{x:Static resources:Strings.Menu_Behaviour_AutoChannelChange_Description}">
|
||||
<ComboBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding ChannelChangeModes, Mode=OneTime}" Text="{Binding SelectedChannelChangeMode, Mode=TwoWay}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource ResourceConverter}, ConverterParameter='Enums.ChannelChangeMode.'}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</controls:OptionControl>
|
||||
|
||||
<controls:OptionControl
|
||||
Header="{x:Static resources:Strings.Menu_Behaviour_ForceRobloxReinstall_Title}"
|
||||
Description="{x:Static resources:Strings.Menu_Behaviour_ForceRobloxReinstall_Description}">
|
||||
|
@ -5,71 +5,6 @@
|
||||
private string _oldPlayerVersionGuid = "";
|
||||
private string _oldStudioVersionGuid = "";
|
||||
|
||||
public BehaviourViewModel()
|
||||
{
|
||||
Task.Run(() => LoadChannelDeployInfo(App.Settings.Prop.Channel));
|
||||
}
|
||||
|
||||
private async Task LoadChannelDeployInfo(string channel)
|
||||
{
|
||||
const string LOG_IDENT = "BehaviourViewModel::LoadChannelDeployInfo";
|
||||
|
||||
ShowLoadingError = false;
|
||||
OnPropertyChanged(nameof(ShowLoadingError));
|
||||
|
||||
ChannelInfoLoadingText = Resources.Strings.Menu_Behaviour_Channel_Fetching;
|
||||
OnPropertyChanged(nameof(ChannelInfoLoadingText));
|
||||
|
||||
ChannelDeployInfo = null;
|
||||
OnPropertyChanged(nameof(ChannelDeployInfo));
|
||||
|
||||
try
|
||||
{
|
||||
ClientVersion info = await RobloxDeployment.GetInfo(channel, true);
|
||||
|
||||
ShowChannelWarning = info.IsBehindDefaultChannel;
|
||||
OnPropertyChanged(nameof(ShowChannelWarning));
|
||||
|
||||
ChannelDeployInfo = new DeployInfo
|
||||
{
|
||||
Version = info.Version,
|
||||
VersionGuid = info.VersionGuid,
|
||||
Timestamp = info.Timestamp?.ToFriendlyString()!
|
||||
};
|
||||
|
||||
OnPropertyChanged(nameof(ChannelDeployInfo));
|
||||
}
|
||||
catch (HttpResponseException ex)
|
||||
{
|
||||
ShowLoadingError = true;
|
||||
OnPropertyChanged(nameof(ShowLoadingError));
|
||||
|
||||
ChannelInfoLoadingText = ex.ResponseMessage.StatusCode switch
|
||||
{
|
||||
HttpStatusCode.NotFound => Resources.Strings.Menu_Behaviour_Channel_DoesNotExist,
|
||||
_ => $"{Resources.Strings.Menu_Behaviour_Channel_FetchFailed} (HTTP {(int)ex.ResponseMessage.StatusCode} - {ex.ResponseMessage.ReasonPhrase})",
|
||||
};
|
||||
OnPropertyChanged(nameof(ChannelInfoLoadingText));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.Logger.WriteLine(LOG_IDENT, "An exception occurred while fetching channel information");
|
||||
App.Logger.WriteException(LOG_IDENT, ex);
|
||||
|
||||
ShowLoadingError = true;
|
||||
OnPropertyChanged(nameof(ShowLoadingError));
|
||||
|
||||
ChannelInfoLoadingText = $"{Resources.Strings.Menu_Behaviour_Channel_FetchFailed} ({ex.Message})";
|
||||
OnPropertyChanged(nameof(ChannelInfoLoadingText));
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowLoadingError { get; set; } = false;
|
||||
public bool ShowChannelWarning { get; set; } = false;
|
||||
|
||||
public DeployInfo? ChannelDeployInfo { get; private set; } = null;
|
||||
public string ChannelInfoLoadingText { get; private set; } = null!;
|
||||
|
||||
public bool CreateDesktopIcon
|
||||
{
|
||||
get => App.Settings.Prop.CreateDesktopIcon;
|
||||
@ -82,30 +17,6 @@
|
||||
set => App.Settings.Prop.CheckForUpdates = value;
|
||||
}
|
||||
|
||||
public string SelectedChannel
|
||||
{
|
||||
get => App.Settings.Prop.Channel;
|
||||
set
|
||||
{
|
||||
value = value.Trim();
|
||||
Task.Run(() => LoadChannelDeployInfo(value));
|
||||
App.Settings.Prop.Channel = value;
|
||||
}
|
||||
}
|
||||
|
||||
public IReadOnlyCollection<ChannelChangeMode> ChannelChangeModes => new ChannelChangeMode[]
|
||||
{
|
||||
ChannelChangeMode.Automatic,
|
||||
ChannelChangeMode.Prompt,
|
||||
ChannelChangeMode.Ignore,
|
||||
};
|
||||
|
||||
public ChannelChangeMode SelectedChannelChangeMode
|
||||
{
|
||||
get => App.Settings.Prop.ChannelChangeMode;
|
||||
set => App.Settings.Prop.ChannelChangeMode = value;
|
||||
}
|
||||
|
||||
public bool ForceRobloxReinstallation
|
||||
{
|
||||
// wouldnt it be better to check old version guids?
|
||||
|
Loading…
Reference in New Issue
Block a user