mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Reorganize stuff
moved around stuff to better reflect the regions they're supposed to be in
This commit is contained in:
parent
6cc701f6a2
commit
826b0a04ca
@ -163,6 +163,9 @@ namespace Bloxstrap
|
|||||||
ShowMessageBox(message, MessageBoxImage.Warning);
|
ShowMessageBox(message, MessageBoxImage.Warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this needs to be loaded this early for the menu and also to check for default values
|
||||||
|
FastFlags.Load();
|
||||||
|
|
||||||
// check if installed
|
// check if installed
|
||||||
using (RegistryKey? registryKey = Registry.CurrentUser.OpenSubKey($@"Software\{ProjectName}"))
|
using (RegistryKey? registryKey = Registry.CurrentUser.OpenSubKey($@"Software\{ProjectName}"))
|
||||||
{
|
{
|
||||||
|
@ -117,6 +117,19 @@ namespace Bloxstrap
|
|||||||
Dialog.Message = message;
|
Dialog.Message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateProgressbar()
|
||||||
|
{
|
||||||
|
int newProgress = (int)Math.Floor(_progressIncrement * _totalDownloadedBytes);
|
||||||
|
|
||||||
|
// bugcheck: if we're restoring a file from a package, it'll incorrectly increment the progress beyond 100
|
||||||
|
// too lazy to fix properly so lol
|
||||||
|
if (newProgress > 100)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Dialog is not null)
|
||||||
|
Dialog.ProgressValue = newProgress;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task Run()
|
public async Task Run()
|
||||||
{
|
{
|
||||||
App.Logger.WriteLine("[Bootstrapper::Run] Running bootstrapper");
|
App.Logger.WriteLine("[Bootstrapper::Run] Running bootstrapper");
|
||||||
@ -175,12 +188,12 @@ namespace Bloxstrap
|
|||||||
if (App.IsFirstRun)
|
if (App.IsFirstRun)
|
||||||
App.ShouldSaveConfigs = true;
|
App.ShouldSaveConfigs = true;
|
||||||
|
|
||||||
IntegrationMigrator.Execute();
|
MigrateIntegrations();
|
||||||
App.FastFlags.Save();
|
|
||||||
|
|
||||||
if (ShouldInstallWebView2)
|
if (ShouldInstallWebView2)
|
||||||
await InstallWebView2();
|
await InstallWebView2();
|
||||||
|
|
||||||
|
App.FastFlags.Save();
|
||||||
await ApplyModifications();
|
await ApplyModifications();
|
||||||
|
|
||||||
if (App.IsFirstRun || FreshInstall)
|
if (App.IsFirstRun || FreshInstall)
|
||||||
@ -201,60 +214,6 @@ namespace Bloxstrap
|
|||||||
await StartRoblox();
|
await StartRoblox();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task CheckForUpdates()
|
|
||||||
{
|
|
||||||
// don't update if there's another instance running (likely running in the background)
|
|
||||||
if (Utilities.GetProcessCount(App.ProjectName) > 1)
|
|
||||||
{
|
|
||||||
App.Logger.WriteLine($"[Bootstrapper::CheckForUpdates] More than one Bloxstrap instance running, aborting update check");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
string currentVersion = $"{App.ProjectName} v{App.Version}";
|
|
||||||
|
|
||||||
App.Logger.WriteLine($"[Bootstrapper::CheckForUpdates] Checking for {App.ProjectName} updates...");
|
|
||||||
|
|
||||||
var releaseInfo = await Utilities.GetJson<GithubRelease>($"https://api.github.com/repos/{App.ProjectRepository}/releases/latest");
|
|
||||||
|
|
||||||
if (releaseInfo?.Assets is null || currentVersion == releaseInfo.Name)
|
|
||||||
{
|
|
||||||
App.Logger.WriteLine($"[Bootstrapper::CheckForUpdates] No updates found");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetStatus($"Getting the latest {App.ProjectName}...");
|
|
||||||
|
|
||||||
// 64-bit is always the first option
|
|
||||||
GithubReleaseAsset asset = releaseInfo.Assets[Environment.Is64BitOperatingSystem ? 0 : 1];
|
|
||||||
string downloadLocation = Path.Combine(Directories.LocalAppData, "Temp", asset.Name);
|
|
||||||
|
|
||||||
App.Logger.WriteLine($"[Bootstrapper::CheckForUpdates] Downloading {releaseInfo.Name}...");
|
|
||||||
|
|
||||||
if (!File.Exists(downloadLocation))
|
|
||||||
{
|
|
||||||
var response = await App.HttpClient.GetAsync(asset.BrowserDownloadUrl);
|
|
||||||
|
|
||||||
await using var fileStream = new FileStream(downloadLocation, FileMode.CreateNew);
|
|
||||||
await response.Content.CopyToAsync(fileStream);
|
|
||||||
}
|
|
||||||
|
|
||||||
App.Logger.WriteLine($"[Bootstrapper::CheckForUpdates] Starting {releaseInfo.Name}...");
|
|
||||||
|
|
||||||
ProcessStartInfo startInfo = new()
|
|
||||||
{
|
|
||||||
FileName = downloadLocation,
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (string arg in App.LaunchArgs)
|
|
||||||
startInfo.ArgumentList.Add(arg);
|
|
||||||
|
|
||||||
App.Settings.Save();
|
|
||||||
|
|
||||||
Process.Start(startInfo);
|
|
||||||
|
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task CheckLatestVersion()
|
private async Task CheckLatestVersion()
|
||||||
{
|
{
|
||||||
SetStatus("Connecting to Roblox...");
|
SetStatus("Connecting to Roblox...");
|
||||||
@ -265,69 +224,6 @@ namespace Bloxstrap
|
|||||||
_versionPackageManifest = await PackageManifest.Get(_latestVersionGuid);
|
_versionPackageManifest = await PackageManifest.Get(_latestVersionGuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckInstallMigration()
|
|
||||||
{
|
|
||||||
// check if we've changed our install location since the last time we started
|
|
||||||
// in which case, we'll have to copy over all our folders so we don't lose any mods and stuff
|
|
||||||
|
|
||||||
using RegistryKey? applicationKey = Registry.CurrentUser.OpenSubKey($@"Software\{App.ProjectName}", true);
|
|
||||||
|
|
||||||
string? oldInstallLocation = (string?)applicationKey?.GetValue("OldInstallLocation");
|
|
||||||
|
|
||||||
if (applicationKey is null || oldInstallLocation is null || oldInstallLocation == Directories.Base)
|
|
||||||
return;
|
|
||||||
|
|
||||||
SetStatus("Migrating install location...");
|
|
||||||
|
|
||||||
if (Directory.Exists(oldInstallLocation))
|
|
||||||
{
|
|
||||||
App.Logger.WriteLine($"[Bootstrapper::CheckInstallMigration] Moving all files in {oldInstallLocation} to {Directories.Base}...");
|
|
||||||
|
|
||||||
foreach (string oldFileLocation in Directory.GetFiles(oldInstallLocation, "*.*", SearchOption.AllDirectories))
|
|
||||||
{
|
|
||||||
string relativeFile = oldFileLocation.Substring(oldInstallLocation.Length + 1);
|
|
||||||
string newFileLocation = Path.Combine(Directories.Base, relativeFile);
|
|
||||||
string? newDirectory = Path.GetDirectoryName(newFileLocation);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!String.IsNullOrEmpty(newDirectory))
|
|
||||||
Directory.CreateDirectory(newDirectory);
|
|
||||||
|
|
||||||
File.Move(oldFileLocation, newFileLocation, true);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
App.Logger.WriteLine($"[Bootstrapper::CheckInstallMigration] Failed to move {oldFileLocation} to {newFileLocation}! {ex}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Directory.Delete(oldInstallLocation, true);
|
|
||||||
App.Logger.WriteLine("[Bootstrapper::CheckInstallMigration] Deleted old install location");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
App.Logger.WriteLine($"[Bootstrapper::CheckInstallMigration] Failed to delete old install location! {ex}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
applicationKey.DeleteValue("OldInstallLocation");
|
|
||||||
|
|
||||||
// allow shortcuts to be re-registered
|
|
||||||
if (Directory.Exists(Directories.StartMenu))
|
|
||||||
Directory.Delete(Directories.StartMenu, true);
|
|
||||||
|
|
||||||
if (File.Exists(DesktopShortcutLocation))
|
|
||||||
{
|
|
||||||
File.Delete(DesktopShortcutLocation);
|
|
||||||
App.Settings.Prop.CreateDesktopIcon = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
App.Logger.WriteLine("[Bootstrapper::CheckInstallMigration] Finished migrating install location!");
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task StartRoblox()
|
private async Task StartRoblox()
|
||||||
{
|
{
|
||||||
string startEventName = App.ProjectName.Replace(" ", "") + "StartEvent";
|
string startEventName = App.ProjectName.Replace(" ", "") + "StartEvent";
|
||||||
@ -464,7 +360,7 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
App.Terminate(ERROR_INSTALL_USEREXIT);
|
App.Terminate(ERROR_INSTALL_USEREXIT);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region App Install
|
#region App Install
|
||||||
public static void Register()
|
public static void Register()
|
||||||
@ -497,6 +393,69 @@ namespace Bloxstrap
|
|||||||
App.Logger.WriteLine("[Bootstrapper::StartRoblox] Registered application");
|
App.Logger.WriteLine("[Bootstrapper::StartRoblox] Registered application");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckInstallMigration()
|
||||||
|
{
|
||||||
|
// check if we've changed our install location since the last time we started
|
||||||
|
// in which case, we'll have to copy over all our folders so we don't lose any mods and stuff
|
||||||
|
|
||||||
|
using RegistryKey? applicationKey = Registry.CurrentUser.OpenSubKey($@"Software\{App.ProjectName}", true);
|
||||||
|
|
||||||
|
string? oldInstallLocation = (string?)applicationKey?.GetValue("OldInstallLocation");
|
||||||
|
|
||||||
|
if (applicationKey is null || oldInstallLocation is null || oldInstallLocation == Directories.Base)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SetStatus("Migrating install location...");
|
||||||
|
|
||||||
|
if (Directory.Exists(oldInstallLocation))
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine($"[Bootstrapper::CheckInstallMigration] Moving all files in {oldInstallLocation} to {Directories.Base}...");
|
||||||
|
|
||||||
|
foreach (string oldFileLocation in Directory.GetFiles(oldInstallLocation, "*.*", SearchOption.AllDirectories))
|
||||||
|
{
|
||||||
|
string relativeFile = oldFileLocation.Substring(oldInstallLocation.Length + 1);
|
||||||
|
string newFileLocation = Path.Combine(Directories.Base, relativeFile);
|
||||||
|
string? newDirectory = Path.GetDirectoryName(newFileLocation);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!String.IsNullOrEmpty(newDirectory))
|
||||||
|
Directory.CreateDirectory(newDirectory);
|
||||||
|
|
||||||
|
File.Move(oldFileLocation, newFileLocation, true);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine($"[Bootstrapper::CheckInstallMigration] Failed to move {oldFileLocation} to {newFileLocation}! {ex}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Directory.Delete(oldInstallLocation, true);
|
||||||
|
App.Logger.WriteLine("[Bootstrapper::CheckInstallMigration] Deleted old install location");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine($"[Bootstrapper::CheckInstallMigration] Failed to delete old install location! {ex}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
applicationKey.DeleteValue("OldInstallLocation");
|
||||||
|
|
||||||
|
// allow shortcuts to be re-registered
|
||||||
|
if (Directory.Exists(Directories.StartMenu))
|
||||||
|
Directory.Delete(Directories.StartMenu, true);
|
||||||
|
|
||||||
|
if (File.Exists(DesktopShortcutLocation))
|
||||||
|
{
|
||||||
|
File.Delete(DesktopShortcutLocation);
|
||||||
|
App.Settings.Prop.CreateDesktopIcon = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
App.Logger.WriteLine("[Bootstrapper::CheckInstallMigration] Finished migrating install location!");
|
||||||
|
}
|
||||||
|
|
||||||
public static void CheckInstall()
|
public static void CheckInstall()
|
||||||
{
|
{
|
||||||
App.Logger.WriteLine("[Bootstrapper::StartRoblox] Checking install");
|
App.Logger.WriteLine("[Bootstrapper::StartRoblox] Checking install");
|
||||||
@ -556,6 +515,60 @@ namespace Bloxstrap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task CheckForUpdates()
|
||||||
|
{
|
||||||
|
// don't update if there's another instance running (likely running in the background)
|
||||||
|
if (Utilities.GetProcessCount(App.ProjectName) > 1)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine($"[Bootstrapper::CheckForUpdates] More than one Bloxstrap instance running, aborting update check");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string currentVersion = $"{App.ProjectName} v{App.Version}";
|
||||||
|
|
||||||
|
App.Logger.WriteLine($"[Bootstrapper::CheckForUpdates] Checking for {App.ProjectName} updates...");
|
||||||
|
|
||||||
|
var releaseInfo = await Utilities.GetJson<GithubRelease>($"https://api.github.com/repos/{App.ProjectRepository}/releases/latest");
|
||||||
|
|
||||||
|
if (releaseInfo?.Assets is null || currentVersion == releaseInfo.Name)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine($"[Bootstrapper::CheckForUpdates] No updates found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetStatus($"Getting the latest {App.ProjectName}...");
|
||||||
|
|
||||||
|
// 64-bit is always the first option
|
||||||
|
GithubReleaseAsset asset = releaseInfo.Assets[Environment.Is64BitOperatingSystem ? 0 : 1];
|
||||||
|
string downloadLocation = Path.Combine(Directories.LocalAppData, "Temp", asset.Name);
|
||||||
|
|
||||||
|
App.Logger.WriteLine($"[Bootstrapper::CheckForUpdates] Downloading {releaseInfo.Name}...");
|
||||||
|
|
||||||
|
if (!File.Exists(downloadLocation))
|
||||||
|
{
|
||||||
|
var response = await App.HttpClient.GetAsync(asset.BrowserDownloadUrl);
|
||||||
|
|
||||||
|
await using var fileStream = new FileStream(downloadLocation, FileMode.CreateNew);
|
||||||
|
await response.Content.CopyToAsync(fileStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
App.Logger.WriteLine($"[Bootstrapper::CheckForUpdates] Starting {releaseInfo.Name}...");
|
||||||
|
|
||||||
|
ProcessStartInfo startInfo = new()
|
||||||
|
{
|
||||||
|
FileName = downloadLocation,
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (string arg in App.LaunchArgs)
|
||||||
|
startInfo.ArgumentList.Add(arg);
|
||||||
|
|
||||||
|
App.Settings.Save();
|
||||||
|
|
||||||
|
Process.Start(startInfo);
|
||||||
|
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
private void Uninstall()
|
private void Uninstall()
|
||||||
{
|
{
|
||||||
// prompt to shutdown roblox if its currently running
|
// prompt to shutdown roblox if its currently running
|
||||||
@ -628,22 +641,9 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
Dialog?.ShowSuccess($"{App.ProjectName} has succesfully uninstalled");
|
Dialog?.ShowSuccess($"{App.ProjectName} has succesfully uninstalled");
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Roblox Install
|
#region Roblox Install
|
||||||
private void UpdateProgressbar()
|
|
||||||
{
|
|
||||||
int newProgress = (int)Math.Floor(_progressIncrement * _totalDownloadedBytes);
|
|
||||||
|
|
||||||
// bugcheck: if we're restoring a file from a package, it'll incorrectly increment the progress beyond 100
|
|
||||||
// too lazy to fix properly so lol
|
|
||||||
if (newProgress > 100)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (Dialog is not null)
|
|
||||||
Dialog.ProgressValue = newProgress;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task InstallLatestVersion()
|
private async Task InstallLatestVersion()
|
||||||
{
|
{
|
||||||
_isInstalling = true;
|
_isInstalling = true;
|
||||||
@ -792,6 +792,32 @@ namespace Bloxstrap
|
|||||||
App.Logger.WriteLine($"[Bootstrapper::InstallWebView2] Finished installing runtime");
|
App.Logger.WriteLine($"[Bootstrapper::InstallWebView2] Finished installing runtime");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void MigrateIntegrations()
|
||||||
|
{
|
||||||
|
// v2.2.0 - remove rbxfpsunlocker
|
||||||
|
string rbxfpsunlocker = Path.Combine(Directories.Integrations, "rbxfpsunlocker");
|
||||||
|
|
||||||
|
if (Directory.Exists(rbxfpsunlocker))
|
||||||
|
Directory.Delete(rbxfpsunlocker, true);
|
||||||
|
|
||||||
|
// v2.2.0 - remove reshade
|
||||||
|
string reshadeLocation = Path.Combine(Directories.Modifications, "dxgi.dll");
|
||||||
|
|
||||||
|
if (File.Exists(reshadeLocation))
|
||||||
|
{
|
||||||
|
App.ShowMessageBox(
|
||||||
|
"As of April 18th, Roblox has started out rolling out the Byfron anticheat as well as 64-bit support. Because of this, ReShade will no longer work, and will be deactivated from now on.\n\n" +
|
||||||
|
$"Your ReShade configs and files will still be kept, which are all located in the {App.ProjectName} folder.",
|
||||||
|
MessageBoxImage.Warning
|
||||||
|
);
|
||||||
|
|
||||||
|
File.Delete(reshadeLocation);
|
||||||
|
|
||||||
|
if (App.FastFlags.GetValue(FastFlagManager.RenderingModes["Direct3D 11"]) == "True" && App.FastFlags.GetValue("FFlagHandleAltEnterFullscreenManually") != "False")
|
||||||
|
App.FastFlags.SetRenderingMode("Automatic");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task ApplyModifications()
|
private async Task ApplyModifications()
|
||||||
{
|
{
|
||||||
SetStatus("Applying Roblox modifications...");
|
SetStatus("Applying Roblox modifications...");
|
||||||
@ -1075,6 +1101,6 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
entry.ExtractToFile(fileLocation);
|
entry.ExtractToFile(fileLocation);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
using System.IO;
|
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace Bloxstrap.Helpers
|
|
||||||
{
|
|
||||||
static class IntegrationMigrator
|
|
||||||
{
|
|
||||||
public static void Execute()
|
|
||||||
{
|
|
||||||
// v2.2.0 - remove rbxfpsunlocker
|
|
||||||
string rbxfpsunlocker = Path.Combine(Directories.Integrations, "rbxfpsunlocker");
|
|
||||||
|
|
||||||
if (Directory.Exists(rbxfpsunlocker))
|
|
||||||
Directory.Delete(rbxfpsunlocker, true);
|
|
||||||
|
|
||||||
// v2.2.0 - remove reshade
|
|
||||||
string reshadeLocation = Path.Combine(Directories.Modifications, "dxgi.dll");
|
|
||||||
|
|
||||||
if (File.Exists(reshadeLocation))
|
|
||||||
{
|
|
||||||
App.ShowMessageBox(
|
|
||||||
"As of April 18th, Roblox has started out rolling out the Byfron anticheat as well as 64-bit support. Because of this, ReShade will no longer work, and will be deactivated from now on.\n\n" +
|
|
||||||
$"Your ReShade configs and files will still be kept, which are all located in the {App.ProjectName} folder.",
|
|
||||||
MessageBoxImage.Warning
|
|
||||||
);
|
|
||||||
|
|
||||||
File.Delete(reshadeLocation);
|
|
||||||
|
|
||||||
if (App.FastFlags.GetValue(FastFlagManager.RenderingModes["Direct3D 11"]) == "True" && App.FastFlags.GetValue("FFlagHandleAltEnterFullscreenManually") != "False")
|
|
||||||
App.FastFlags.SetRenderingMode("Automatic");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -13,8 +13,6 @@ namespace Bloxstrap.Views.Pages
|
|||||||
{
|
{
|
||||||
public ModsPage()
|
public ModsPage()
|
||||||
{
|
{
|
||||||
App.FastFlags.Load();
|
|
||||||
|
|
||||||
DataContext = new ModsViewModel();
|
DataContext = new ModsViewModel();
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user