From 3143b176669d2396ccfc2c81d20ed01101a242a7 Mon Sep 17 00:00:00 2001 From: pizzaboxer <41478239+pizzaboxer@users.noreply.github.com> Date: Sat, 4 Feb 2023 21:32:35 +0000 Subject: [PATCH] Move mod manifest to State.json --- Bloxstrap/Bootstrapper.cs | 18 ++++++++---------- .../Helpers/Integrations/RbxFpsUnlocker.cs | 2 ++ Bloxstrap/Helpers/Integrations/ReShade.cs | 6 ++++++ Bloxstrap/Models/State.cs | 1 + 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index eb80e6f..827c031 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -564,9 +564,10 @@ namespace Bloxstrap Dialog.Message = "Applying Roblox modifications..."; string modFolder = Path.Combine(Directories.Modifications); - string manifestFile = Path.Combine(Directories.Base, "ModManifest.txt"); - List manifestFiles = new(); + // manifest has been moved to State.json + File.Delete(Path.Combine(Directories.Base, "ModManifest.txt")); + List modFolderFiles = new(); if (!Directory.Exists(modFolder)) @@ -594,12 +595,6 @@ namespace Bloxstrap modFolderFiles.Add(relativeFile); } - // the manifest is primarily here to keep track of what files have been - // deleted from the modifications folder, so that we know when to restore the - // original files from the downloaded packages - - manifestFiles = File.Exists(manifestFile) ? (await File.ReadAllLinesAsync(manifestFile)).ToList() : modFolderFiles; - // copy and overwrite foreach (string file in modFolderFiles) { @@ -623,8 +618,10 @@ namespace Bloxstrap File.SetAttributes(fileVersionFolder, File.GetAttributes(fileModFolder) & ~FileAttributes.ReadOnly); } + // the manifest is primarily here to keep track of what files have been + // deleted from the modifications folder, so that we know when to restore the original files from the downloaded packages // now check for files that have been deleted from the mod folder according to the manifest - foreach (string fileLocation in manifestFiles) + foreach (string fileLocation in App.State.Prop.ModManifest) { if (modFolderFiles.Contains(fileLocation)) continue; @@ -650,7 +647,8 @@ namespace Bloxstrap ExtractFileFromPackage(packageDirectory.Key, fileName); } - await File.WriteAllLinesAsync(manifestFile, modFolderFiles); + App.State.Prop.ModManifest = modFolderFiles; + App.State.Save(); } private static async Task CheckModPreset(bool condition, string location, string name) diff --git a/Bloxstrap/Helpers/Integrations/RbxFpsUnlocker.cs b/Bloxstrap/Helpers/Integrations/RbxFpsUnlocker.cs index 612c82c..36f640e 100644 --- a/Bloxstrap/Helpers/Integrations/RbxFpsUnlocker.cs +++ b/Bloxstrap/Helpers/Integrations/RbxFpsUnlocker.cs @@ -60,6 +60,7 @@ namespace Bloxstrap.Helpers.Integrations if (!App.Settings.Prop.RFUEnabled) { App.State.Prop.RbxFpsUnlockerVersion = ""; + App.State.Save(); if (Directory.Exists(folderLocation)) { @@ -104,6 +105,7 @@ namespace Bloxstrap.Helpers.Integrations await File.WriteAllTextAsync(settingsLocation, Settings); App.State.Prop.RbxFpsUnlockerVersion = releaseInfo.TagName; + App.State.Save(); } } } diff --git a/Bloxstrap/Helpers/Integrations/ReShade.cs b/Bloxstrap/Helpers/Integrations/ReShade.cs index 0b7648a..284dc89 100644 --- a/Bloxstrap/Helpers/Integrations/ReShade.cs +++ b/Bloxstrap/Helpers/Integrations/ReShade.cs @@ -327,6 +327,7 @@ namespace Bloxstrap.Helpers.Integrations { UninstallExtraviPresets(); App.State.Prop.ExtraviReShadePresetsVersion = ""; + App.State.Save(); } if (!App.Settings.Prop.UseReShade) @@ -338,6 +339,7 @@ namespace Bloxstrap.Helpers.Integrations File.Delete(ConfigLocation); App.State.Prop.ReShadeConfigVersion = ""; + App.State.Save(); //DeleteShaders("Stock"); if (Directory.Exists(BaseDirectory)) @@ -393,7 +395,10 @@ namespace Bloxstrap.Helpers.Integrations await DownloadConfig(); if (versionManifest is not null) + { App.State.Prop.ReShadeConfigVersion = versionManifest.ConfigFile; + App.State.Save(); + } } await DownloadShaders("Stock"); @@ -402,6 +407,7 @@ namespace Bloxstrap.Helpers.Integrations { await InstallExtraviPresets(); App.State.Prop.ExtraviReShadePresetsVersion = versionManifest.Presets; + App.State.Save(); } SynchronizeConfigFile(); diff --git a/Bloxstrap/Models/State.cs b/Bloxstrap/Models/State.cs index c6203ca..fcc2d7c 100644 --- a/Bloxstrap/Models/State.cs +++ b/Bloxstrap/Models/State.cs @@ -12,5 +12,6 @@ namespace Bloxstrap.Models public string RbxFpsUnlockerVersion { get; set; } = ""; public string ReShadeConfigVersion { get; set; } = ""; public string ExtraviReShadePresetsVersion { get; set; } = ""; + public List ModManifest { get; set; } = new(); } }