Skip to content

Commit

Permalink
Merge pull request #232 from 1011025m/byfron-splash
Browse files Browse the repository at this point in the history
Add "Hyperion" bootstrapper style
  • Loading branch information
pizzaboxer authored May 14, 2023
2 parents 39d9198 + a50a032 commit a0bebba
Show file tree
Hide file tree
Showing 15 changed files with 236 additions and 14 deletions.
2 changes: 2 additions & 0 deletions Bloxstrap/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<ui:ThemesDictionary Theme="Dark" />
<ui:ControlsDictionary />
</ResourceDictionary.MergedDictionaries>

<FontFamily x:Key="Rubik">pack://application:,,,/Resources/Fonts/#Rubik Light</FontFamily>
</ResourceDictionary>
</Application.Resources>
</Application>
3 changes: 3 additions & 0 deletions Bloxstrap/Bloxstrap.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

<ItemGroup>
<Resource Include="Bloxstrap.ico" />
<Resource Include="Resources\Fonts\Rubik-VariableFont_wght.ttf" />
<Resource Include="Resources\BootstrapperStyles\ByfronDialog\ByfronLogoDark.jpg" />
<Resource Include="Resources\BootstrapperStyles\ByfronDialog\ByfronLogoLight.jpg" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 6 additions & 3 deletions Bloxstrap/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using Bloxstrap.Integrations;
using Bloxstrap.Models;
using Bloxstrap.Tools;
using System.Globalization;

namespace Bloxstrap
{
Expand Down Expand Up @@ -111,6 +110,10 @@ private void SetStatus(string message)
{
App.Logger.WriteLine($"[Bootstrapper::SetStatus] {message}");

// yea idk
if (App.Settings.Prop.BootstrapperStyle == BootstrapperStyle.ByfronDialog)
message = message.Replace("...", "");

if (Dialog is not null)
Dialog.Message = message;
}
Expand Down Expand Up @@ -790,11 +793,11 @@ private async Task InstallLatestVersion()
}
}

App.State.Prop.VersionGuid = _latestVersionGuid;

if (Dialog is not null)
Dialog.CancelEnabled = false;

App.State.Prop.VersionGuid = _latestVersionGuid;

_isInstalling = false;
}

Expand Down
45 changes: 45 additions & 0 deletions Bloxstrap/Dialogs/ByfronDialog.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<Window x:Class="Bloxstrap.Dialogs.ByfronDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Bloxstrap.Dialogs"
mc:Ignorable="d"
Width="600"
Height="400"
ResizeMode="NoResize"
WindowStyle="None"
WindowStartupLocation="CenterScreen"
AllowsTransparency="True"
Background="Transparent">
<Border CornerRadius="10" BorderBrush="#33393B3D" Background="{Binding Background}" BorderThickness="{Binding DialogBorder}">
<Grid>
<Image Source="{Binding ByfronLogoLocation}" Width="114" Height="108" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="17,13,0,0" />
<Button Margin="15" VerticalAlignment="Top" HorizontalAlignment="Right" Width="20" Height="20" BorderThickness="0" Padding="1" Background="Transparent" BorderBrush="Transparent" Visibility="{Binding CancelButtonVisibility, Mode=OneWay}" Command="{Binding CancelInstallCommand}">
<Path Fill="{Binding IconColor}" Stretch="Fill">
<Path.Data>
<PathGeometry Figures="m 6.7507011 2.1168752 c -1.0144874 0 -2.0291944 0.3884677 -2.8065471 1.1658203 -1.5547052 1.5547053 -1.5547052 4.0583888 10e-8 5.6130941 L 28.499761 33.45088 3.9441541 58.006487 c -1.5547058 1.554706 -1.5547051 4.057873 0 5.612578 1.554705 1.554705 4.0583891 1.554705 5.6130942 0 l 24.5550907 -24.55509 24.555607 24.55509 c 1.554705 1.554705 4.057871 1.554705 5.612577 0 1.554705 -1.554706 1.554705 -4.057872 0 -5.612577 L 39.725433 33.450881 64.280523 8.89579 c 1.554706 -1.5547058 1.554705 -4.0583892 0 -5.6130942 -1.554705 -1.5547051 -4.057872 -1.5547058 -5.612578 -7e-7 L 34.112338 27.838303 9.5572482 3.2826955 C 8.7798955 2.5053428 7.7651883 2.1168752 6.7507011 2.1168752 Z" FillRule="NonZero"/>
</Path.Data>
</Path>
</Button>
<TextBlock Margin="15" VerticalAlignment="Top" HorizontalAlignment="Right" FontSize="10" FontFamily="{StaticResource Rubik}" Text="{Binding VersionText}" Foreground="{Binding Foreground}" Visibility="{Binding VersionTextVisibility, Mode=OneWay}" />
<Path Fill="{Binding IconColor}" Width="300" Height="56" Stretch="Fill">
<Path.Data>
<PathGeometry Figures="M38.5796 38.4043L47.7906 55.2626H30.6999L22.9226 40.8556H15.5546V55.2626H0V4.19308H28.4486C40.2169 4.19308 47.6883 10.7246 47.6883 22.4706C47.6883 30.0289 44.209 35.4433 38.5796 38.4043ZM15.5546 17.4658V27.5775H26.6066C29.8813 27.5775 31.9279 25.6369 31.9279 22.4706C31.9279 19.3043 29.8813 17.4658 26.6066 17.4658H15.5546ZM97.2175 59.0374L50.656 46.4743L63.1406 0L86.4214 6.28155L109.702 12.5631L97.2175 59.0374ZM88.4169 24.8198L75.4206 21.2449L71.9413 34.2166L84.9376 37.7925L88.4169 24.8198ZM163.019 40.8556C163.019 50.661 156.777 55.2626 147.055 55.2626H116.56V4.19308H146.032C155.753 4.19308 161.995 9.19789 161.995 17.9818C161.995 23.4973 159.949 27.1754 156.06 29.7289C160.461 31.6631 163.019 35.5455 163.019 40.8556ZM131.705 16.4498V24.008H141.83C144.593 24.008 146.231 22.7824 146.231 20.1268C146.231 17.6754 144.593 16.4498 141.83 16.4498H131.705ZM131.705 43.0059H143.064C145.725 43.0059 147.265 41.576 147.265 39.1235C147.265 36.469 145.73 35.2433 143.064 35.2433H131.705V43.0059ZM170.694 4.19308H186.246V40.1417H208.555V55.2626H170.692L170.694 4.19308ZM265.762 29.7289C265.762 34.9812 264.202 40.1156 261.278 44.4827C258.355 48.8498 254.199 52.2536 249.338 54.2636C244.476 56.2736 239.126 56.7995 233.965 55.7748C228.804 54.7501 224.063 52.2209 220.342 48.5069C216.621 44.793 214.087 40.0611 213.06 34.9098C212.034 29.7584 212.561 24.4188 214.574 19.5663C216.588 14.7138 219.998 10.5663 224.374 7.64828C228.749 4.73025 233.893 3.17276 239.156 3.17276C242.651 3.16582 246.114 3.8478 249.345 5.17958C252.575 6.51135 255.511 8.46672 257.983 10.9335C260.455 13.4003 262.415 16.3299 263.75 19.5544C265.085 22.7788 265.769 26.2346 265.762 29.7235V29.7289ZM250.208 29.7289C250.208 23.3952 245.193 18.3904 239.156 18.3904C233.118 18.3904 228.103 23.3952 228.103 29.7289C228.103 36.0626 233.118 41.0663 239.156 41.0663C245.193 41.0663 250.208 36.0551 250.208 29.7235V29.7289ZM303.216 28.9107L320 55.2626H301.472L292.267 40.2428L282.75 55.2626H263.92L281.419 29.5225L265.353 4.19308H283.875L292.369 17.9818L300.556 4.19308H318.976L303.216 28.9107Z" FillRule="NonZero"/>
</Path.Data>
</Path>
<Grid Margin="0,0,0,29" VerticalAlignment="Bottom">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Margin="0,0,0,23" TextAlignment="Center" Grid.Row="0" Text="{Binding Message}" Foreground="{Binding Foreground}" FontFamily="{StaticResource Rubik}" FontSize="17" FontWeight="Light">
<TextBlock.LayoutTransform>
<ScaleTransform ScaleY="0.9"/>
</TextBlock.LayoutTransform>
</TextBlock>
<ProgressBar Grid.Row="1" Width="480" Height="12" Foreground="{Binding Foreground}" Background="{Binding ProgressBarBackground}" BorderThickness="0" IsIndeterminate="{Binding ProgressIndeterminate}" Value="{Binding ProgressValue}"></ProgressBar>
</Grid>
</Grid>
</Border>
</Window>
119 changes: 119 additions & 0 deletions Bloxstrap/Dialogs/ByfronDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
using System;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Media;
using System.Windows.Media.Imaging;

using Bloxstrap.Enums;
using Bloxstrap.Extensions;
using Bloxstrap.ViewModels;

namespace Bloxstrap.Dialogs
{
/// <summary>
/// Interaction logic for ByfronDialog.xaml
/// </summary>
public partial class ByfronDialog : IBootstrapperDialog
{
private readonly ByfronDialogViewModel _viewModel;

public Bootstrapper? Bootstrapper { get; set; }

#region UI Elements
public string Message
{
get => _viewModel.Message;
set
{
_viewModel.Message = value;
_viewModel.OnPropertyChanged(nameof(_viewModel.Message));
}
}

public ProgressBarStyle ProgressStyle
{
get => _viewModel.ProgressIndeterminate ? ProgressBarStyle.Marquee : ProgressBarStyle.Continuous;
set
{
_viewModel.ProgressIndeterminate = (value == ProgressBarStyle.Marquee);
_viewModel.OnPropertyChanged(nameof(_viewModel.ProgressIndeterminate));
}
}

public int ProgressValue
{
get => _viewModel.ProgressValue;
set
{
_viewModel.ProgressValue = value;
_viewModel.OnPropertyChanged(nameof(_viewModel.ProgressValue));
}
}

public bool CancelEnabled
{
get => _viewModel.CancelButtonVisibility == Visibility.Visible;
set
{
_viewModel.CancelButtonVisibility = (value ? Visibility.Visible : Visibility.Collapsed);
_viewModel.OnPropertyChanged(nameof(_viewModel.CancelButtonVisibility));

_viewModel.OnPropertyChanged(nameof(_viewModel.VersionTextVisibility));
_viewModel.OnPropertyChanged(nameof(_viewModel.VersionText));
}
}
#endregion

public ByfronDialog()
{
_viewModel = new ByfronDialogViewModel(this);
DataContext = _viewModel;
Title = App.Settings.Prop.BootstrapperTitle;
Icon = App.Settings.Prop.BootstrapperIcon.GetIcon().GetImageSource();

if (App.Settings.Prop.Theme.GetFinal() == Theme.Light)
{
// Matching the roblox website light theme as close as possible.
_viewModel.DialogBorder = new Thickness(1);
_viewModel.Background = new SolidColorBrush(Color.FromRgb(242, 244, 245));
_viewModel.Foreground = new SolidColorBrush(Color.FromRgb(57, 59, 61));
_viewModel.IconColor = new SolidColorBrush(Color.FromRgb(57, 59, 61));
_viewModel.ProgressBarBackground = new SolidColorBrush(Color.FromRgb(189, 190, 190));
_viewModel.ByfronLogoLocation = new BitmapImage(new Uri("pack://application:,,,/Resources/BootstrapperStyles/ByfronDialog/ByfronLogoLight.jpg"));
}

InitializeComponent();
}

#region IBootstrapperDialog Methods
// Referencing FluentDialog
public void ShowBootstrapper() => this.ShowDialog();

public void CloseBootstrapper() => Dispatcher.BeginInvoke(this.Close);

public void ShowSuccess(string message)
{
App.ShowMessageBox(message, MessageBoxImage.Information);
App.Terminate();
}

public void ShowError(string message)
{
App.ShowMessageBox($"An error occurred while starting Roblox\n\nDetails: {message}", MessageBoxImage.Error);
App.Terminate(Bootstrapper.ERROR_INSTALL_FAILURE);
}

public void PromptShutdown()
{
MessageBoxResult result = App.ShowMessageBox(
"Roblox is currently running, but needs to close. Would you like close Roblox now?",
MessageBoxImage.Information,
MessageBoxButton.OKCancel
);

if (result != MessageBoxResult.OK)
Environment.Exit(Bootstrapper.ERROR_INSTALL_USEREXIT);
}
#endregion
}
}
3 changes: 2 additions & 1 deletion Bloxstrap/Enums/BootstrapperStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public enum BootstrapperStyle
LegacyDialog2009,
LegacyDialog2011,
ProgressDialog,
FluentDialog
FluentDialog,
ByfronDialog
}
}
1 change: 1 addition & 0 deletions Bloxstrap/Extensions/BootstrapperStyleEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public static IBootstrapperDialog GetNew(this BootstrapperStyle bootstrapperStyl
BootstrapperStyle.LegacyDialog2011 => new LegacyDialog2011(),
BootstrapperStyle.ProgressDialog => new ProgressDialog(),
BootstrapperStyle.FluentDialog => new FluentDialog(),
BootstrapperStyle.ByfronDialog => new ByfronDialog(),
_ => new FluentDialog()
};
}
Expand Down
2 changes: 1 addition & 1 deletion Bloxstrap/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
8 changes: 7 additions & 1 deletion Bloxstrap/ViewModels/AppearanceViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ public class AppearanceViewModel : INotifyPropertyChanged
private void PreviewBootstrapper()
{
IBootstrapperDialog dialog = App.Settings.Prop.BootstrapperStyle.GetNew();
dialog.Message = "Style preview - Click Cancel to close";

if (App.Settings.Prop.BootstrapperStyle == BootstrapperStyle.ByfronDialog)
dialog.Message = "Style preview - Click the X button at the top right to close";
else
dialog.Message = "Style preview - Click Cancel to close";

dialog.CancelEnabled = true;
dialog.ShowBootstrapper();
}
Expand Down Expand Up @@ -75,6 +80,7 @@ public string Theme
{ "Legacy (2011 - 2014)", BootstrapperStyle.LegacyDialog2011 },
{ "Legacy (2009 - 2011)", BootstrapperStyle.LegacyDialog2009 },
{ "Vista (2009 - 2011)", BootstrapperStyle.VistaDialog },
{ "Fake Byfron (2023)", BootstrapperStyle.ByfronDialog },
};

public string Dialog
Expand Down
46 changes: 46 additions & 0 deletions Bloxstrap/ViewModels/ByfronDialogViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;

using Bloxstrap.Dialogs;

namespace Bloxstrap.ViewModels
{
public class ByfronDialogViewModel : FluentDialogViewModel, INotifyPropertyChanged
{
// Using dark theme for default values.
public ImageSource ByfronLogoLocation { get; set; } = new BitmapImage(new Uri("pack://application:,,,/Resources/BootstrapperStyles/ByfronDialog/ByfronLogoDark.jpg"));
public Thickness DialogBorder { get; set; } = new Thickness(0);
public Brush Background { get; set; } = Brushes.Black;
public Brush Foreground { get; set; } = new SolidColorBrush(Color.FromRgb(239, 239, 239));
public Brush IconColor { get; set; } = new SolidColorBrush(Color.FromRgb(255, 255, 255));
public Brush ProgressBarBackground { get; set; } = new SolidColorBrush(Color.FromRgb(86, 86, 86));

public Visibility VersionTextVisibility => CancelButtonVisibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
public string VersionText
{
get
{
string playerLocation = Path.Combine(Directories.Versions, App.State.Prop.VersionGuid, "RobloxPlayerBeta.exe");

if (!File.Exists(playerLocation))
return "";

FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(playerLocation);

if (versionInfo.ProductVersion is null)
return "";

return versionInfo.ProductVersion.Replace(", ", ".");
}
}

public ByfronDialogViewModel(IBootstrapperDialog dialog) : base(dialog)
{
}
}
}
10 changes: 3 additions & 7 deletions Bloxstrap/ViewModels/FluentDialogViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;

using CommunityToolkit.Mvvm.Input;

using Bloxstrap.Dialogs;
using Bloxstrap.Enums;
using Bloxstrap.Extensions;

namespace Bloxstrap.ViewModels
Expand Down
2 changes: 1 addition & 1 deletion Bloxstrap/Views/Pages/AboutPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<TextBlock Grid.Row="2" Grid.Column="0" Margin="0,4,16,4" FontSize="14" FontWeight="Medium">
<Hyperlink Foreground="{DynamicResource TextFillColorPrimaryBrush}" Command="models:GlobalViewModel.OpenWebpageCommand" CommandParameter="https://github.com/1011025m">1011025m</Hyperlink>
</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="1" Margin="0,4,0,4" VerticalAlignment="Bottom" Text="Providing a method for disabling the Roblox desktop app" Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
<TextBlock Grid.Row="2" Grid.Column="1" Margin="0,4,0,4" VerticalAlignment="Bottom" Text="Helping disable the Roblox desktop app, and adding the fake Byfron bootstrapper style" Foreground="{DynamicResource TextFillColorTertiaryBrush}" />

<TextBlock Grid.Row="3" Grid.Column="0" Margin="0,4,16,4" FontSize="14" FontWeight="Medium">
<Hyperlink Foreground="{DynamicResource TextFillColorPrimaryBrush}" Command="models:GlobalViewModel.OpenWebpageCommand" CommandParameter="https://github.com/sitiom">sitiom</Hyperlink>
Expand Down

0 comments on commit a0bebba

Please sign in to comment.