diff --git a/Bloxstrap/App.xaml b/Bloxstrap/App.xaml index 8f4642f9..c46ad487 100644 --- a/Bloxstrap/App.xaml +++ b/Bloxstrap/App.xaml @@ -11,6 +11,8 @@ + + pack://application:,,,/Resources/Fonts/#Rubik Light diff --git a/Bloxstrap/Bloxstrap.csproj b/Bloxstrap/Bloxstrap.csproj index 05de60f8..544d5cb1 100644 --- a/Bloxstrap/Bloxstrap.csproj +++ b/Bloxstrap/Bloxstrap.csproj @@ -14,6 +14,9 @@ + + + diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 5b915ebe..8df2c368 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -17,7 +17,6 @@ using Bloxstrap.Integrations; using Bloxstrap.Models; using Bloxstrap.Tools; -using System.Globalization; namespace Bloxstrap { @@ -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; } @@ -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; } diff --git a/Bloxstrap/Dialogs/ByfronDialog.xaml b/Bloxstrap/Dialogs/ByfronDialog.xaml new file mode 100644 index 00000000..d2cda202 --- /dev/null +++ b/Bloxstrap/Dialogs/ByfronDialog.xaml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Bloxstrap/Dialogs/ByfronDialog.xaml.cs b/Bloxstrap/Dialogs/ByfronDialog.xaml.cs new file mode 100644 index 00000000..a689121e --- /dev/null +++ b/Bloxstrap/Dialogs/ByfronDialog.xaml.cs @@ -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 +{ + /// + /// Interaction logic for ByfronDialog.xaml + /// + 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 + } +} diff --git a/Bloxstrap/Enums/BootstrapperStyle.cs b/Bloxstrap/Enums/BootstrapperStyle.cs index 69aa77a8..cade7cbd 100644 --- a/Bloxstrap/Enums/BootstrapperStyle.cs +++ b/Bloxstrap/Enums/BootstrapperStyle.cs @@ -6,6 +6,7 @@ public enum BootstrapperStyle LegacyDialog2009, LegacyDialog2011, ProgressDialog, - FluentDialog + FluentDialog, + ByfronDialog } } diff --git a/Bloxstrap/Extensions/BootstrapperStyleEx.cs b/Bloxstrap/Extensions/BootstrapperStyleEx.cs index 0a6ef0bc..f25c616f 100644 --- a/Bloxstrap/Extensions/BootstrapperStyleEx.cs +++ b/Bloxstrap/Extensions/BootstrapperStyleEx.cs @@ -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() }; } diff --git a/Bloxstrap/Properties/Resources.Designer.cs b/Bloxstrap/Properties/Resources.Designer.cs index 202cd2e8..2e365792 100644 --- a/Bloxstrap/Properties/Resources.Designer.cs +++ b/Bloxstrap/Properties/Resources.Designer.cs @@ -59,7 +59,7 @@ internal Resources() { resourceCulture = value; } } - + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/Bloxstrap/Resources/BootstrapperStyles/ByfronDialog/ByfronLogoDark.jpg b/Bloxstrap/Resources/BootstrapperStyles/ByfronDialog/ByfronLogoDark.jpg new file mode 100644 index 00000000..770e46b1 Binary files /dev/null and b/Bloxstrap/Resources/BootstrapperStyles/ByfronDialog/ByfronLogoDark.jpg differ diff --git a/Bloxstrap/Resources/BootstrapperStyles/ByfronDialog/ByfronLogoLight.jpg b/Bloxstrap/Resources/BootstrapperStyles/ByfronDialog/ByfronLogoLight.jpg new file mode 100644 index 00000000..4e79772c Binary files /dev/null and b/Bloxstrap/Resources/BootstrapperStyles/ByfronDialog/ByfronLogoLight.jpg differ diff --git a/Bloxstrap/Resources/Fonts/Rubik-VariableFont_wght.ttf b/Bloxstrap/Resources/Fonts/Rubik-VariableFont_wght.ttf new file mode 100644 index 00000000..547f0697 Binary files /dev/null and b/Bloxstrap/Resources/Fonts/Rubik-VariableFont_wght.ttf differ diff --git a/Bloxstrap/ViewModels/AppearanceViewModel.cs b/Bloxstrap/ViewModels/AppearanceViewModel.cs index d0d21854..ba85815f 100644 --- a/Bloxstrap/ViewModels/AppearanceViewModel.cs +++ b/Bloxstrap/ViewModels/AppearanceViewModel.cs @@ -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(); } @@ -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 diff --git a/Bloxstrap/ViewModels/ByfronDialogViewModel.cs b/Bloxstrap/ViewModels/ByfronDialogViewModel.cs new file mode 100644 index 00000000..6178606a --- /dev/null +++ b/Bloxstrap/ViewModels/ByfronDialogViewModel.cs @@ -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) + { + } + } +} diff --git a/Bloxstrap/ViewModels/FluentDialogViewModel.cs b/Bloxstrap/ViewModels/FluentDialogViewModel.cs index fc81ba17..881c4d4b 100644 --- a/Bloxstrap/ViewModels/FluentDialogViewModel.cs +++ b/Bloxstrap/ViewModels/FluentDialogViewModel.cs @@ -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 diff --git a/Bloxstrap/Views/Pages/AboutPage.xaml b/Bloxstrap/Views/Pages/AboutPage.xaml index a455e90e..9c984ebc 100644 --- a/Bloxstrap/Views/Pages/AboutPage.xaml +++ b/Bloxstrap/Views/Pages/AboutPage.xaml @@ -70,7 +70,7 @@ 1011025m - + sitiom