mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-05-13 03:34:42 -07:00
use a function for byfron dialog version text
This commit is contained in:
parent
c46a4ec022
commit
cf963c4bda
@ -69,7 +69,8 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
|
||||
|
||||
public ByfronDialog()
|
||||
{
|
||||
_viewModel = new ByfronDialogViewModel(this, Bootstrapper?.IsStudioLaunch ?? false);
|
||||
string version = Utilities.GetRobloxVersion(Bootstrapper?.IsStudioLaunch ?? false);
|
||||
_viewModel = new ByfronDialogViewModel(this, version);
|
||||
DataContext = _viewModel;
|
||||
Title = App.Settings.Prop.BootstrapperTitle;
|
||||
Icon = App.Settings.Prop.BootstrapperIcon.GetIcon().GetImageSource();
|
||||
|
@ -6,8 +6,6 @@ namespace Bloxstrap.UI.ViewModels.Bootstrapper
|
||||
{
|
||||
public class ByfronDialogViewModel : BootstrapperDialogViewModel
|
||||
{
|
||||
private bool _studioLaunch;
|
||||
|
||||
// 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);
|
||||
@ -18,30 +16,11 @@ namespace Bloxstrap.UI.ViewModels.Bootstrapper
|
||||
|
||||
public Visibility VersionTextVisibility => CancelEnabled ? Visibility.Collapsed : Visibility.Visible;
|
||||
|
||||
public string VersionText
|
||||
public string VersionText { get; init; }
|
||||
|
||||
public ByfronDialogViewModel(IBootstrapperDialog dialog, string version) : base(dialog)
|
||||
{
|
||||
get
|
||||
{
|
||||
string versionGuid = _studioLaunch ? App.State.Prop.StudioVersionGuid : App.State.Prop.PlayerVersionGuid;
|
||||
string fileName = _studioLaunch ? "RobloxStudioBeta.exe" : "RobloxPlayerBeta.exe";
|
||||
|
||||
string playerLocation = Path.Combine(Paths.Versions, versionGuid, fileName);
|
||||
|
||||
if (!File.Exists(playerLocation))
|
||||
return "";
|
||||
|
||||
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(playerLocation);
|
||||
|
||||
if (versionInfo.ProductVersion is null)
|
||||
return "";
|
||||
|
||||
return versionInfo.ProductVersion.Replace(", ", ".");
|
||||
}
|
||||
}
|
||||
|
||||
public ByfronDialogViewModel(IBootstrapperDialog dialog, bool isStudioLaunch) : base(dialog)
|
||||
{
|
||||
_studioLaunch = isStudioLaunch;
|
||||
VersionText = version;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,5 +47,23 @@ namespace Bloxstrap
|
||||
|
||||
return version1.CompareTo(version2);
|
||||
}
|
||||
|
||||
public static string GetRobloxVersion(bool studio)
|
||||
{
|
||||
string versionGuid = studio ? App.State.Prop.StudioVersionGuid : App.State.Prop.PlayerVersionGuid;
|
||||
string fileName = studio ? "RobloxStudioBeta.exe" : "RobloxPlayerBeta.exe";
|
||||
|
||||
string playerLocation = Path.Combine(Paths.Versions, versionGuid, fileName);
|
||||
|
||||
if (!File.Exists(playerLocation))
|
||||
return "";
|
||||
|
||||
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(playerLocation);
|
||||
|
||||
if (versionInfo.ProductVersion is null)
|
||||
return "";
|
||||
|
||||
return versionInfo.ProductVersion.Replace(", ", ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user