From 1f91c309ca94828998bb692beb5b909e825932d2 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Sun, 14 May 2023 01:39:28 +0100 Subject: [PATCH] Add client version number Finalizing the fake Byfron style --- Bloxstrap/Bootstrapper.cs | 9 +++++--- Bloxstrap/Dialogs/ByfronDialog.xaml | 7 +++--- Bloxstrap/Dialogs/ByfronDialog.xaml.cs | 3 +++ Bloxstrap/ViewModels/ByfronDialogViewModel.cs | 23 +++++++++++++++++-- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 5b915eb..8df2c36 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -17,7 +17,6 @@ using Bloxstrap.Enums; using Bloxstrap.Integrations; using Bloxstrap.Models; using Bloxstrap.Tools; -using System.Globalization; namespace Bloxstrap { @@ -111,6 +110,10 @@ namespace Bloxstrap { 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 @@ namespace Bloxstrap } } + 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 index 2747e05..d2cda20 100644 --- a/Bloxstrap/Dialogs/ByfronDialog.xaml +++ b/Bloxstrap/Dialogs/ByfronDialog.xaml @@ -15,24 +15,25 @@ - + - + - + diff --git a/Bloxstrap/Dialogs/ByfronDialog.xaml.cs b/Bloxstrap/Dialogs/ByfronDialog.xaml.cs index f9aa671..a689121 100644 --- a/Bloxstrap/Dialogs/ByfronDialog.xaml.cs +++ b/Bloxstrap/Dialogs/ByfronDialog.xaml.cs @@ -57,6 +57,9 @@ namespace Bloxstrap.Dialogs { _viewModel.CancelButtonVisibility = (value ? Visibility.Visible : Visibility.Collapsed); _viewModel.OnPropertyChanged(nameof(_viewModel.CancelButtonVisibility)); + + _viewModel.OnPropertyChanged(nameof(_viewModel.VersionTextVisibility)); + _viewModel.OnPropertyChanged(nameof(_viewModel.VersionText)); } } #endregion diff --git a/Bloxstrap/ViewModels/ByfronDialogViewModel.cs b/Bloxstrap/ViewModels/ByfronDialogViewModel.cs index 30cae23..6178606 100644 --- a/Bloxstrap/ViewModels/ByfronDialogViewModel.cs +++ b/Bloxstrap/ViewModels/ByfronDialogViewModel.cs @@ -1,5 +1,7 @@ using System; using System.ComponentModel; +using System.Diagnostics; +using System.IO; using System.Windows; using System.Windows.Media; using System.Windows.Media.Imaging; @@ -10,8 +12,6 @@ namespace Bloxstrap.ViewModels { public class ByfronDialogViewModel : FluentDialogViewModel, INotifyPropertyChanged { - public string Version => $"Bloxstrap v{App.Version}"; - // 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); @@ -20,6 +20,25 @@ namespace Bloxstrap.ViewModels 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) { }