mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Add program size estimation
conditions are kinda messy but its fine
This commit is contained in:
parent
54b65f8728
commit
57e6454fd7
@ -188,7 +188,10 @@ namespace Bloxstrap
|
||||
await ApplyModifications();
|
||||
|
||||
if (App.IsFirstRun || FreshInstall)
|
||||
{
|
||||
Register();
|
||||
RegisterProgramSize();
|
||||
}
|
||||
|
||||
CheckInstall();
|
||||
|
||||
@ -425,6 +428,20 @@ namespace Bloxstrap
|
||||
App.Logger.WriteLine("[Bootstrapper::StartRoblox] Registered application");
|
||||
}
|
||||
|
||||
public void RegisterProgramSize()
|
||||
{
|
||||
App.Logger.WriteLine("[Bootstrapper::RegisterProgramSize] Registering approximate program size...");
|
||||
|
||||
using RegistryKey uninstallKey = Registry.CurrentUser.CreateSubKey($"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{App.ProjectName}");
|
||||
|
||||
// sum compressed and uncompressed package sizes and convert to kilobytes
|
||||
int totalSize = (_versionPackageManifest.Sum(x => x.Size) + _versionPackageManifest.Sum(x => x.PackedSize)) / 1000;
|
||||
|
||||
uninstallKey.SetValue("EstimatedSize", totalSize);
|
||||
|
||||
App.Logger.WriteLine($"[Bootstrapper::RegisterProgramSize] Registered as {totalSize} KB");
|
||||
}
|
||||
|
||||
private void CheckInstallMigration()
|
||||
{
|
||||
// check if we've changed our install location since the last time we started
|
||||
@ -785,6 +802,10 @@ namespace Bloxstrap
|
||||
|
||||
App.State.Prop.VersionGuid = _latestVersionGuid;
|
||||
|
||||
// don't register program size until the program is registered
|
||||
if (!App.IsFirstRun && !FreshInstall)
|
||||
RegisterProgramSize();
|
||||
|
||||
if (Dialog is not null)
|
||||
Dialog.CancelEnabled = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user