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.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
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);
|
LaunchSettings = new LaunchSettings(e.Args);
|
||||||
|
|
||||||
HttpClient.Timeout = TimeSpan.FromSeconds(30);
|
HttpClient.Timeout = TimeSpan.FromSeconds(30);
|
||||||
@ -135,13 +151,6 @@ namespace Bloxstrap
|
|||||||
// REMOVE WHEN LARGER REFACTORING IS DONE
|
// REMOVE WHEN LARGER REFACTORING IS DONE
|
||||||
await RobloxDeployment.InitializeConnectivity();
|
await RobloxDeployment.InitializeConnectivity();
|
||||||
|
|
||||||
using (var checker = new InstallChecker())
|
|
||||||
{
|
|
||||||
checker.Check();
|
|
||||||
}
|
|
||||||
|
|
||||||
Paths.Initialize(BaseDirectory);
|
|
||||||
|
|
||||||
// disallow running as administrator except for uninstallation
|
// disallow running as administrator except for uninstallation
|
||||||
if (Utilities.IsAdministrator && !LaunchSettings.IsUninstall)
|
if (Utilities.IsAdministrator && !LaunchSettings.IsUninstall)
|
||||||
{
|
{
|
||||||
@ -168,10 +177,6 @@ namespace Bloxstrap
|
|||||||
Logger.WriteLine(LOG_IDENT, "Possible duplicate launch detected, terminating.");
|
Logger.WriteLine(LOG_IDENT, "Possible duplicate launch detected, terminating.");
|
||||||
Terminate();
|
Terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings.Load();
|
|
||||||
State.Load();
|
|
||||||
FastFlags.Load();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LaunchSettings.IsUninstall && !LaunchSettings.IsMenuLaunch)
|
if (!LaunchSettings.IsUninstall && !LaunchSettings.IsMenuLaunch)
|
||||||
|
@ -257,26 +257,11 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
if (clientVersion.IsBehindDefaultChannel)
|
if (clientVersion.IsBehindDefaultChannel)
|
||||||
{
|
{
|
||||||
MessageBoxResult action = App.Settings.Prop.ChannelChangeMode switch
|
App.Logger.WriteLine(LOG_IDENT, $"Changed Roblox channel from {App.Settings.Prop.Channel} to {RobloxDeployment.DefaultChannel}");
|
||||||
{
|
|
||||||
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
|
|
||||||
};
|
|
||||||
|
|
||||||
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;
|
App.Settings.Prop.Channel = RobloxDeployment.DefaultChannel;
|
||||||
clientVersion = await RobloxDeployment.GetInfo(App.Settings.Prop.Channel, binaryType: binaryType);
|
clientVersion = await RobloxDeployment.GetInfo(App.Settings.Prop.Channel, binaryType: binaryType);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_latestVersionGuid = clientVersion.VersionGuid;
|
_latestVersionGuid = clientVersion.VersionGuid;
|
||||||
_versionFolder = Path.Combine(Paths.Versions, _latestVersionGuid);
|
_versionFolder = Path.Combine(Paths.Versions, _latestVersionGuid);
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
namespace Bloxstrap.Enums
|
|
||||||
{
|
|
||||||
public enum ChannelChangeMode
|
|
||||||
{
|
|
||||||
Automatic,
|
|
||||||
Prompt,
|
|
||||||
Ignore
|
|
||||||
}
|
|
||||||
}
|
|
@ -20,7 +20,6 @@ namespace Bloxstrap.Models
|
|||||||
|
|
||||||
// channel configuration
|
// channel configuration
|
||||||
public string Channel { get; set; } = RobloxDeployment.DefaultChannel;
|
public string Channel { get; set; } = RobloxDeployment.DefaultChannel;
|
||||||
public ChannelChangeMode ChannelChangeMode { get; set; } = ChannelChangeMode.Automatic;
|
|
||||||
|
|
||||||
// integration configuration
|
// integration configuration
|
||||||
public bool EnableActivityTracking { get; set; } = true;
|
public bool EnableActivityTracking { get; set; } = true;
|
||||||
|
@ -51,27 +51,17 @@ namespace Bloxstrap
|
|||||||
if (channel.ToLowerInvariant() == App.Settings.Prop.Channel.ToLowerInvariant())
|
if (channel.ToLowerInvariant() == App.Settings.Prop.Channel.ToLowerInvariant())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (App.Settings.Prop.ChannelChangeMode == ChannelChangeMode.Ignore)
|
// don't change if roblox is already running
|
||||||
return;
|
if (Process.GetProcessesByName("RobloxPlayerBeta").Any())
|
||||||
|
|
||||||
if (App.Settings.Prop.ChannelChangeMode != ChannelChangeMode.Automatic)
|
|
||||||
{
|
{
|
||||||
if (channel == App.State.Prop.LastEnrolledChannel)
|
App.Logger.WriteLine("ProtocolHandler::ChangeChannel", $"Ignored channel change from {App.Settings.Prop.Channel} to {channel} because Roblox is already running");
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
App.Logger.WriteLine("Protocol::ParseUri", $"Changed Roblox channel from {App.Settings.Prop.Channel} to {channel}");
|
{
|
||||||
|
App.Logger.WriteLine("ProtocolHandler::ChangeChannel", $"Changed Roblox channel from {App.Settings.Prop.Channel} to {channel}");
|
||||||
App.Settings.Prop.Channel = channel;
|
App.Settings.Prop.Channel = channel;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void EnrollChannel(string channel)
|
public static void EnrollChannel(string channel)
|
||||||
{
|
{
|
||||||
|
@ -29,131 +29,6 @@
|
|||||||
<ui:ToggleSwitch IsChecked="{Binding UpdateCheckingEnabled, Mode=TwoWay}" />
|
<ui:ToggleSwitch IsChecked="{Binding UpdateCheckingEnabled, Mode=TwoWay}" />
|
||||||
</controls:OptionControl>
|
</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
|
<controls:OptionControl
|
||||||
Header="{x:Static resources:Strings.Menu_Behaviour_ForceRobloxReinstall_Title}"
|
Header="{x:Static resources:Strings.Menu_Behaviour_ForceRobloxReinstall_Title}"
|
||||||
Description="{x:Static resources:Strings.Menu_Behaviour_ForceRobloxReinstall_Description}">
|
Description="{x:Static resources:Strings.Menu_Behaviour_ForceRobloxReinstall_Description}">
|
||||||
|
@ -5,71 +5,6 @@
|
|||||||
private string _oldPlayerVersionGuid = "";
|
private string _oldPlayerVersionGuid = "";
|
||||||
private string _oldStudioVersionGuid = "";
|
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
|
public bool CreateDesktopIcon
|
||||||
{
|
{
|
||||||
get => App.Settings.Prop.CreateDesktopIcon;
|
get => App.Settings.Prop.CreateDesktopIcon;
|
||||||
@ -82,30 +17,6 @@
|
|||||||
set => App.Settings.Prop.CheckForUpdates = value;
|
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
|
public bool ForceRobloxReinstallation
|
||||||
{
|
{
|
||||||
// wouldnt it be better to check old version guids?
|
// wouldnt it be better to check old version guids?
|
||||||
|
Loading…
Reference in New Issue
Block a user