Skip to content

Commit

Permalink
Finalize update for v1.2.0
Browse files Browse the repository at this point in the history
 - Features
    - Added three new bootstrapper styles (Vista, Legacy 2009 and Progress Dark Theme)
    - Added ability to disable rich presence activity buttons
    - Added ability to restore old mouse cursor

 - Quality of Life
    - Refactored code for bootstrapper styles
  • Loading branch information
pizzaboxer committed Aug 16, 2022
1 parent 6152bce commit 462d48f
Show file tree
Hide file tree
Showing 33 changed files with 1,157 additions and 420 deletions.
10 changes: 8 additions & 2 deletions Bloxstrap/Bloxstrap.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<Platforms>AnyCPU;x86</Platforms>
<ApplicationIcon>Bloxstrap.ico</ApplicationIcon>
<Version>1.1.0</Version>
<FileVersion>1.1.0.0</FileVersion>
<Version>1.2.0</Version>
<FileVersion>1.2.0.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand All @@ -27,6 +27,12 @@
</ItemGroup>

<ItemGroup>
<Compile Update="Dialogs\BootstrapperStyles\LegacyDialog2009.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Dialogs\BootstrapperStyles\ProgressDialogDark.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
Expand Down
3 changes: 0 additions & 3 deletions Bloxstrap/Bootstrapper/Bootstrapper.AppInstall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ private void Uninstall()

CheckIfRunning();

// lots of try/catches here... lol

Message = $"Uninstalling {Program.ProjectName}...";

Program.SettingsManager.ShouldSave = false;
Expand Down Expand Up @@ -122,7 +120,6 @@ private void Uninstall()
catch (Exception) { }

ShowSuccess($"{Program.ProjectName} has been uninstalled");
Program.Exit();
}
}
}
39 changes: 37 additions & 2 deletions Bloxstrap/Bootstrapper/Bootstrapper.RobloxInstall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ private async Task InstallLatestVersion()
File.Delete(filename);
}

// and also to delete our old version folder
Directory.Delete(Path.Combine(Program.BaseDirectory, "Versions", Program.Settings.VersionGuid), true);
if (VersionGuid != Program.Settings.VersionGuid)
{
// and also to delete our old version folder
Directory.Delete(Path.Combine(Program.BaseDirectory, "Versions", Program.Settings.VersionGuid), true);
}
}

CancelEnabled = false;
Expand All @@ -115,6 +118,7 @@ private async void ApplyModifications()
// but for now, let's just keep it at this

await ModifyDeathSound();
await ModifyMouseCursor();
}

private async void DownloadPackage(Package package)
Expand Down Expand Up @@ -204,5 +208,36 @@ private void ExtractPackage(Package package)
}
}
}

private void ExtractFilesFromPackage(string packageName, string[] files)
{
Package? package = VersionPackageManifest.Find(x => x.Name == packageName);

if (package is null)
return;

DownloadPackage(package);

string packageLocation = Path.Combine(DownloadsFolder, package.Signature);
string packageFolder = Path.Combine(VersionFolder, PackageDirectories[package.Name]);

using (ZipArchive archive = ZipFile.OpenRead(packageLocation))
{
foreach (string fileName in files)
{
ZipArchiveEntry? entry = archive.Entries.Where(x => x.FullName == fileName).FirstOrDefault();

if (entry is null)
return;

string fileLocation = Path.Combine(packageFolder, entry.FullName);

if (File.Exists(fileLocation))
File.Delete(fileLocation);

entry.ExtractToFile(fileLocation);
}
}
}
}
}
52 changes: 27 additions & 25 deletions Bloxstrap/Bootstrapper/Bootstrapper.RobloxModifications.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.IO.Compression;

using Bloxstrap.Helpers;
using Bloxstrap.Helpers;

namespace Bloxstrap
{
Expand All @@ -12,10 +10,10 @@ private async Task ModifyDeathSound()
string fileContentLocation = "content\\sounds\\ouch.ogg";
string fileLocation = Path.Combine(VersionFolder, fileContentLocation);

string officialDeathSoundHash = VersionFileManifest[fileContentLocation];
string currentDeathSoundHash = Utilities.CalculateMD5(fileLocation);
string officialHash = VersionFileManifest[fileContentLocation];
string currentHash = Utilities.CalculateMD5(fileLocation);

if (Program.Settings.UseOldDeathSound && currentDeathSoundHash == officialDeathSoundHash)
if (Program.Settings.UseOldDeathSound && currentHash == officialHash)
{
// let's get the old one!

Expand All @@ -29,33 +27,37 @@ private async Task ModifyDeathSound()
await response.Content.CopyToAsync(fileStream);
}
}
else if (!Program.Settings.UseOldDeathSound && currentDeathSoundHash != officialDeathSoundHash)
else if (!Program.Settings.UseOldDeathSound && currentHash != officialHash)
{
// who's lame enough to ever do this?
// well, we need to re-extract the one that's in the content-sounds.zip package

var package = VersionPackageManifest.Find(x => x.Name == "content-sounds.zip");

if (package is null)
return;

DownloadPackage(package);

string packageLocation = Path.Combine(DownloadsFolder, package.Signature);
string packageFolder = Path.Combine(VersionFolder, PackageDirectories[package.Name]);
string[] files = { fileContentName };
ExtractFilesFromPackage("content-sounds.zip", files);
}
}

using (ZipArchive archive = ZipFile.OpenRead(packageLocation))
{
ZipArchiveEntry? entry = archive.Entries.Where(x => x.FullName == fileContentName).FirstOrDefault();
private async Task ModifyMouseCursor()
{
string baseFolder = Path.Combine(VersionFolder, "content\\textures\\");

string arrowCursor = "Cursors\\KeyboardMouse\\ArrowCursor.png";
string arrowFarCursor = "Cursors\\KeyboardMouse\\ArrowFarCursor.png";

if (entry is null)
return;
string officialHash = VersionFileManifest["content\\textures\\Cursors\\KeyboardMouse\\ArrowCursor.png"];
string currentHash = Utilities.CalculateMD5(Path.Combine(baseFolder, arrowCursor));

if (File.Exists(fileLocation))
File.Delete(fileLocation);
if (Program.Settings.UseOldMouseCursor && currentHash == officialHash)
{
// the old cursors are actually still in the content\textures\ folder, so we can just get them from there

entry.ExtractToFile(fileLocation);
}
File.Copy(Path.Combine(baseFolder, "ArrowCursor.png"), Path.Combine(baseFolder, arrowCursor), true);
File.Copy(Path.Combine(baseFolder, "ArrowFarCursor.png"), Path.Combine(baseFolder, arrowFarCursor), true);
}
else if (!Program.Settings.UseOldMouseCursor && currentHash != officialHash)
{
string[] files = { arrowCursor, arrowFarCursor };
ExtractFilesFromPackage("content-textures2.zip", files);
}
}
}
Expand Down
15 changes: 12 additions & 3 deletions Bloxstrap/Bootstrapper/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,24 @@ public void Initialize(BootstrapperStyle bootstrapperStyle, string? launchComman
switch (bootstrapperStyle)
{
case BootstrapperStyle.VistaDialog:
new VistaDialog(this);
Application.Run(new VistaDialog(this));
break;

case BootstrapperStyle.LegacyDialog:
Application.Run(new LegacyDialog(this));
case BootstrapperStyle.LegacyDialog2009:
Application.Run(new LegacyDialog2009(this));
break;

case BootstrapperStyle.LegacyDialog2011:
Application.Run(new LegacyDialog2011(this));
break;

case BootstrapperStyle.ProgressDialog:
Application.Run(new ProgressDialog(this));
break;

case BootstrapperStyle.ProgressDialogDark:
Application.Run(new ProgressDialogDark(this));
break;
}
}

Expand Down Expand Up @@ -136,6 +144,7 @@ private async Task StartRoblox()
return;

CloseDialog();

await gameClient.WaitForExitAsync();
}
}
Expand Down
Loading

0 comments on commit 462d48f

Please sign in to comment.