mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
get rid of base64 mod strings
This commit is contained in:
parent
498d0f9c60
commit
f9ec5c1523
@ -18,6 +18,12 @@
|
|||||||
<Content Include="Bloxstrap.ico" />
|
<Content Include="Bloxstrap.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Resources\Mods\OldCursor.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Mods\OldDeath.ogg" />
|
||||||
|
<EmbeddedResource Include="Resources\Mods\OldFarCursor.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DiscordRichPresence" Version="1.1.3.18" />
|
<PackageReference Include="DiscordRichPresence" Version="1.1.3.18" />
|
||||||
<PackageReference Include="securifybv.ShellLink" Version="0.1.0" />
|
<PackageReference Include="securifybv.ShellLink" Version="0.1.0" />
|
||||||
|
@ -113,7 +113,7 @@ namespace Bloxstrap
|
|||||||
if (!Directory.Exists(VersionFolder) && CheckIfRunning(true) || Program.Settings.VersionGuid != VersionGuid && !CheckIfRunning(false))
|
if (!Directory.Exists(VersionFolder) && CheckIfRunning(true) || Program.Settings.VersionGuid != VersionGuid && !CheckIfRunning(false))
|
||||||
await InstallLatestVersion();
|
await InstallLatestVersion();
|
||||||
|
|
||||||
ApplyModifications();
|
await ApplyModifications();
|
||||||
|
|
||||||
if (Program.IsFirstRun)
|
if (Program.IsFirstRun)
|
||||||
Program.SettingsManager.ShouldSave = true;
|
Program.SettingsManager.ShouldSave = true;
|
||||||
@ -472,7 +472,7 @@ namespace Bloxstrap
|
|||||||
Program.Settings.VersionGuid = VersionGuid;
|
Program.Settings.VersionGuid = VersionGuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApplyModifications()
|
private async Task ApplyModifications()
|
||||||
{
|
{
|
||||||
Dialog.Message = "Applying Roblox modifications...";
|
Dialog.Message = "Applying Roblox modifications...";
|
||||||
|
|
||||||
@ -485,13 +485,13 @@ namespace Bloxstrap
|
|||||||
if (!Directory.Exists(modFolder))
|
if (!Directory.Exists(modFolder))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(modFolder);
|
Directory.CreateDirectory(modFolder);
|
||||||
File.WriteAllText(Path.Combine(modFolder, "README.txt"), ModReadme);
|
await File.WriteAllTextAsync(Path.Combine(modFolder, "README.txt"), ModReadme);
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckModPreset(Program.Settings.UseOldDeathSound, @"content\sounds\ouch.ogg", Program.Base64OldDeathSound);
|
await CheckModPreset(Program.Settings.UseOldDeathSound, @"content\sounds\ouch.ogg", "OldDeath.ogg");
|
||||||
CheckModPreset(Program.Settings.UseOldMouseCursor, @"content\textures\Cursors\KeyboardMouse\ArrowCursor.png", Program.Base64OldArrowCursor);
|
await CheckModPreset(Program.Settings.UseOldMouseCursor, @"content\textures\Cursors\KeyboardMouse\ArrowCursor.png", "OldCursor.png");
|
||||||
CheckModPreset(Program.Settings.UseOldMouseCursor, @"content\textures\Cursors\KeyboardMouse\ArrowFarCursor.png", Program.Base64OldArrowFarCursor);
|
await CheckModPreset(Program.Settings.UseOldMouseCursor, @"content\textures\Cursors\KeyboardMouse\ArrowFarCursor.png", "OldFarCursor.png");
|
||||||
CheckModPreset(Program.Settings.UseDisableAppPatch, @"ExtraContent\places\Mobile.rbxl", "");
|
await CheckModPreset(Program.Settings.UseDisableAppPatch, @"ExtraContent\places\Mobile.rbxl", "");
|
||||||
|
|
||||||
foreach (string file in Directory.GetFiles(modFolder, "*.*", SearchOption.AllDirectories))
|
foreach (string file in Directory.GetFiles(modFolder, "*.*", SearchOption.AllDirectories))
|
||||||
{
|
{
|
||||||
@ -510,7 +510,7 @@ namespace Bloxstrap
|
|||||||
// original files from the downloaded packages
|
// original files from the downloaded packages
|
||||||
|
|
||||||
if (File.Exists(manifestFile))
|
if (File.Exists(manifestFile))
|
||||||
manifestFiles = File.ReadAllLines(manifestFile).ToList<string>();
|
manifestFiles = (await File.ReadAllLinesAsync(manifestFile)).ToList();
|
||||||
else
|
else
|
||||||
manifestFiles = modFolderFiles;
|
manifestFiles = modFolderFiles;
|
||||||
|
|
||||||
@ -564,10 +564,10 @@ namespace Bloxstrap
|
|||||||
File.WriteAllLines(manifestFile, modFolderFiles);
|
File.WriteAllLines(manifestFile, modFolderFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CheckModPreset(bool condition, string location, string base64Contents)
|
private static async Task CheckModPreset(bool condition, string location, string name)
|
||||||
{
|
{
|
||||||
string modFolderLocation = Path.Combine(Directories.Modifications, location);
|
string modFolderLocation = Path.Combine(Directories.Modifications, location);
|
||||||
byte[] binaryData = Convert.FromBase64String(base64Contents);
|
byte[] binaryData = string.IsNullOrEmpty(name) ? new byte[0] : await ResourceHelper.Get(name);
|
||||||
|
|
||||||
if (condition)
|
if (condition)
|
||||||
{
|
{
|
||||||
@ -580,7 +580,7 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
Directory.CreateDirectory(directory);
|
Directory.CreateDirectory(directory);
|
||||||
|
|
||||||
File.WriteAllBytes(modFolderLocation, binaryData);
|
await File.WriteAllBytesAsync(modFolderLocation, binaryData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (File.Exists(modFolderLocation) && Utilities.MD5File(modFolderLocation) == Utilities.MD5Data(binaryData))
|
else if (File.Exists(modFolderLocation) && Utilities.MD5File(modFolderLocation) == Utilities.MD5Data(binaryData))
|
||||||
|
23
Bloxstrap/Helpers/ResourceHelper.cs
Normal file
23
Bloxstrap/Helpers/ResourceHelper.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Bloxstrap.Helpers
|
||||||
|
{
|
||||||
|
internal class ResourceHelper
|
||||||
|
{
|
||||||
|
static Assembly assembly = Assembly.GetExecutingAssembly();
|
||||||
|
static string[] resourceNames = assembly.GetManifestResourceNames();
|
||||||
|
|
||||||
|
public static async Task<byte[]> Get(string name)
|
||||||
|
{
|
||||||
|
string path = resourceNames.Single(str => str.EndsWith(name));
|
||||||
|
|
||||||
|
using (Stream stream = assembly.GetManifestResourceStream(path)!)
|
||||||
|
using (MemoryStream memoryStream = new MemoryStream())
|
||||||
|
{
|
||||||
|
await stream.CopyToAsync(memoryStream);
|
||||||
|
return memoryStream.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
BIN
Bloxstrap/Resources/Mods/OldCursor.png
Normal file
BIN
Bloxstrap/Resources/Mods/OldCursor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 232 B |
BIN
Bloxstrap/Resources/Mods/OldDeath.ogg
Normal file
BIN
Bloxstrap/Resources/Mods/OldDeath.ogg
Normal file
Binary file not shown.
BIN
Bloxstrap/Resources/Mods/OldFarCursor.png
Normal file
BIN
Bloxstrap/Resources/Mods/OldFarCursor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 235 B |
Loading…
Reference in New Issue
Block a user