From cc22ee15912e65edd01a22f5725cc141895ab8ed Mon Sep 17 00:00:00 2001 From: pizzaboxer <41478239+pizzaboxer@users.noreply.github.com> Date: Wed, 8 Mar 2023 21:25:40 +0000 Subject: [PATCH] Whitespace formatting, move Integrations folder --- Bloxstrap/Bootstrapper.cs | 2 +- .../Integrations/DiscordRichPresence.cs | 13 ++-- .../Integrations/RbxFpsUnlocker.cs | 7 ++- .../{Helpers => }/Integrations/ReShade.cs | 63 ++++++++++--------- 4 files changed, 44 insertions(+), 41 deletions(-) rename Bloxstrap/{Helpers => }/Integrations/DiscordRichPresence.cs (96%) rename Bloxstrap/{Helpers => }/Integrations/RbxFpsUnlocker.cs (97%) rename Bloxstrap/{Helpers => }/Integrations/ReShade.cs (93%) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 2141107..b9f2a9a 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -14,9 +14,9 @@ using Microsoft.Win32; using Bloxstrap.Dialogs; using Bloxstrap.Helpers; -using Bloxstrap.Helpers.Integrations; using Bloxstrap.Helpers.RSMM; using Bloxstrap.Models; +using Bloxstrap.Integrations; namespace Bloxstrap { diff --git a/Bloxstrap/Helpers/Integrations/DiscordRichPresence.cs b/Bloxstrap/Integrations/DiscordRichPresence.cs similarity index 96% rename from Bloxstrap/Helpers/Integrations/DiscordRichPresence.cs rename to Bloxstrap/Integrations/DiscordRichPresence.cs index 5b07b64..aaea215 100644 --- a/Bloxstrap/Helpers/Integrations/DiscordRichPresence.cs +++ b/Bloxstrap/Integrations/DiscordRichPresence.cs @@ -6,12 +6,13 @@ using System.Linq; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; +using Bloxstrap.Helpers; using Bloxstrap.Models; using DiscordRPC; -namespace Bloxstrap.Helpers.Integrations +namespace Bloxstrap.Integrations { class DiscordRichPresence : IDisposable { @@ -36,10 +37,10 @@ namespace Bloxstrap.Helpers.Integrations public DiscordRichPresence() { - _rpcClient.OnReady += (_, e) => + _rpcClient.OnReady += (_, e) => App.Logger.WriteLine($"[DiscordRichPresence::DiscordRichPresence] Received ready from user {e.User.Username} ({e.User.ID})"); - _rpcClient.OnPresenceUpdate += (_, e) => + _rpcClient.OnPresenceUpdate += (_, e) => App.Logger.WriteLine("[DiscordRichPresence::DiscordRichPresence] Updated presence"); _rpcClient.OnConnectionEstablished += (_, e) => @@ -62,7 +63,7 @@ namespace Bloxstrap.Helpers.Integrations // debug stats to ensure that the log reader is working correctly // if more than 5000 log entries have been read, only log per 100 to save on spam - if (_logEntriesRead <= 5000 && _logEntriesRead % 50 == 0) + if (_logEntriesRead <= 5000 && _logEntriesRead % 50 == 0) App.Logger.WriteLine($"[DiscordRichPresence::ExamineLogEntry] Read {_logEntriesRead} log entries"); else if (_logEntriesRead % 100 == 0) App.Logger.WriteLine($"[DiscordRichPresence::ExamineLogEntry] Read {_logEntriesRead} log entries"); @@ -75,7 +76,7 @@ namespace Bloxstrap.Helpers.Integrations return; _activityInGame = false; - _activityPlaceId = Int64.Parse(match.Groups[2].Value); + _activityPlaceId = long.Parse(match.Groups[2].Value); _activityJobId = match.Groups[1].Value; _activityMachineAddress = match.Groups[3].Value; @@ -160,7 +161,7 @@ namespace Bloxstrap.Helpers.Integrations { string? log = await sr.ReadLineAsync(); - if (String.IsNullOrEmpty(log)) + if (string.IsNullOrEmpty(log)) logUpdatedEvent.WaitOne(1000); else await ExamineLogEntry(log); diff --git a/Bloxstrap/Helpers/Integrations/RbxFpsUnlocker.cs b/Bloxstrap/Integrations/RbxFpsUnlocker.cs similarity index 97% rename from Bloxstrap/Helpers/Integrations/RbxFpsUnlocker.cs rename to Bloxstrap/Integrations/RbxFpsUnlocker.cs index d353bfe..49dd9d4 100644 --- a/Bloxstrap/Helpers/Integrations/RbxFpsUnlocker.cs +++ b/Bloxstrap/Integrations/RbxFpsUnlocker.cs @@ -3,10 +3,11 @@ using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Threading.Tasks; +using Bloxstrap.Helpers; using Bloxstrap.Models; -namespace Bloxstrap.Helpers.Integrations +namespace Bloxstrap.Integrations { internal class RbxFpsUnlocker { @@ -14,7 +15,7 @@ namespace Bloxstrap.Helpers.Integrations public const string ProjectRepository = "axstin/rbxfpsunlocker"; // default settings but with QuickStart set to true and CheckForUpdates set to false - private static readonly string Settings = + private static readonly string Settings = "UnlockClient=true\n" + "UnlockStudio=false\n" + "FPSCapValues=[30.000000, 60.000000, 75.000000, 120.000000, 144.000000, 165.000000, 240.000000, 360.000000]\n" + @@ -33,7 +34,7 @@ namespace Bloxstrap.Helpers.Integrations return; App.Logger.WriteLine("[RbxFpsUnlocker::CheckIfRunning] Closing currently running rbxfpsunlocker processes..."); - + try { foreach (Process process in processes) diff --git a/Bloxstrap/Helpers/Integrations/ReShade.cs b/Bloxstrap/Integrations/ReShade.cs similarity index 93% rename from Bloxstrap/Helpers/Integrations/ReShade.cs rename to Bloxstrap/Integrations/ReShade.cs index b19c3f8..f68cfbf 100644 --- a/Bloxstrap/Helpers/Integrations/ReShade.cs +++ b/Bloxstrap/Integrations/ReShade.cs @@ -7,13 +7,14 @@ using System.IO; using System.IO.Compression; using System.Linq; using System.Threading.Tasks; +using Bloxstrap.Helpers; using Bloxstrap.Models; using IniParser; using IniParser.Model; -namespace Bloxstrap.Helpers.Integrations +namespace Bloxstrap.Integrations { internal class ReShade { @@ -64,9 +65,9 @@ namespace Bloxstrap.Helpers.Integrations } }, - new ReShadeShaderConfig - { - Name = "AlucardDH", + new ReShadeShaderConfig + { + Name = "AlucardDH", DownloadLocation = "https://github.com/AlucardDH/dh-reshade-shaders/archive/refs/heads/master.zip", ExcludedFiles = new List() { @@ -77,10 +78,10 @@ namespace Bloxstrap.Helpers.Integrations } }, - new ReShadeShaderConfig - { - Name = "Stormshade", - DownloadLocation = "https://github.com/cyrie/Stormshade/archive/refs/heads/master.zip", + new ReShadeShaderConfig + { + Name = "Stormshade", + DownloadLocation = "https://github.com/cyrie/Stormshade/archive/refs/heads/master.zip", BaseFolder = "reshade-shaders/", ExcludedFiles = new List() { @@ -114,8 +115,8 @@ namespace Bloxstrap.Helpers.Integrations "prod80", "qUINT", "StockLegacy", - "Stormshade", - "SweetFX", + "Stormshade", + "SweetFX", }; private static string GetSearchPath(string type, string name) @@ -378,7 +379,7 @@ namespace Bloxstrap.Helpers.Integrations string injectorLocation = Path.Combine(Directories.Modifications, "dxgi.dll"); - if (!App.Settings.Prop.UseReShadeExtraviPresets && !String.IsNullOrEmpty(App.State.Prop.ExtraviReShadePresetsVersion)) + if (!App.Settings.Prop.UseReShadeExtraviPresets && !string.IsNullOrEmpty(App.State.Prop.ExtraviReShadePresetsVersion)) { if (Utilities.GetProcessCount("RobloxPlayerBeta") > 0) return; @@ -398,7 +399,7 @@ namespace Bloxstrap.Helpers.Integrations // we should already be uninstalled // we want to ensure this is done one-time only as this could possibly interfere with other rendering hooks using dxgi.dll - if (String.IsNullOrEmpty(App.State.Prop.ReShadeConfigVersion)) + if (string.IsNullOrEmpty(App.State.Prop.ReShadeConfigVersion)) return; App.Logger.WriteLine("[ReShade::CheckModifications] Uninstalling ReShade..."); @@ -433,43 +434,43 @@ namespace Bloxstrap.Helpers.Integrations if (injectorVersionInfo.ProductVersion != versionManifest.ReShade) shouldFetchReShade = true; - // UPDATE CHECK - if we're upgrading to reshade 5.7.0, or we have extravi's presets + // UPDATE CHECK - if we're upgrading to reshade 5.7.0, or we have extravi's presets // enabled with a known shader downloaded (like AlucardDH) but without stormshade downloaded (5.7.0+ specific), // we need to redownload all our shaders fresh - if ( - injectorVersionInfo.ProductVersion != versionManifest.ReShade && versionManifest.ReShade == "5.7.0" || + if ( + injectorVersionInfo.ProductVersion != versionManifest.ReShade && versionManifest.ReShade == "5.7.0" || App.Settings.Prop.UseReShadeExtraviPresets && Directory.Exists(Path.Combine(ShadersFolder, "AlucardDH")) && !Directory.Exists(Path.Combine(ShadersFolder, "Stormshade")) ) - { - Directory.Delete(ShadersFolder, true); - Directory.Delete(TexturesFolder, true); + { + Directory.Delete(ShadersFolder, true); + Directory.Delete(TexturesFolder, true); App.State.Prop.ExtraviReShadePresetsVersion = ""; App.Logger.WriteLine("[ReShade::CheckModifications] Upgrading to ReShade 5.7.0 - redownloading all shaders!"); - } - } + } + } else { App.Logger.WriteLine("[ReShade::CheckModifications] versionManifest is null!"); } - // we're about to download - initialize directories - Directory.CreateDirectory(BaseDirectory); - Directory.CreateDirectory(FontsFolder); - Directory.CreateDirectory(ShadersFolder); - Directory.CreateDirectory(TexturesFolder); - Directory.CreateDirectory(PresetsFolder); + // we're about to download - initialize directories + Directory.CreateDirectory(BaseDirectory); + Directory.CreateDirectory(FontsFolder); + Directory.CreateDirectory(ShadersFolder); + Directory.CreateDirectory(TexturesFolder); + Directory.CreateDirectory(PresetsFolder); - // check if we should download a fresh copy of the config - // extravi may need to update the config ota, in which case we'll redownload it - if (!File.Exists(ConfigLocation) || versionManifest is not null && App.State.Prop.ReShadeConfigVersion != versionManifest.ConfigFile) + // check if we should download a fresh copy of the config + // extravi may need to update the config ota, in which case we'll redownload it + if (!File.Exists(ConfigLocation) || versionManifest is not null && App.State.Prop.ReShadeConfigVersion != versionManifest.ConfigFile) shouldFetchConfig = true; if (shouldFetchReShade) { App.Logger.WriteLine("[ReShade::CheckModifications] Installing/Upgrading ReShade..."); - { - byte[] bytes = await App.HttpClient.GetByteArrayAsync($"{BaseUrl}/dxgi.zip"); + { + byte[] bytes = await App.HttpClient.GetByteArrayAsync($"{BaseUrl}/dxgi.zip"); using MemoryStream zipStream = new(bytes); using ZipArchive archive = new(zipStream); archive.ExtractToDirectory(Directories.Modifications, true);