Move mod manifest to State.json

This commit is contained in:
pizzaboxer 2023-02-04 21:32:35 +00:00
parent c1b892787a
commit 3143b17666
4 changed files with 17 additions and 10 deletions

View File

@ -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<string> manifestFiles = new();
// manifest has been moved to State.json
File.Delete(Path.Combine(Directories.Base, "ModManifest.txt"));
List<string> 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)

View File

@ -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();
}
}
}

View File

@ -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();

View File

@ -12,5 +12,6 @@ namespace Bloxstrap.Models
public string RbxFpsUnlockerVersion { get; set; } = "";
public string ReShadeConfigVersion { get; set; } = "";
public string ExtraviReShadePresetsVersion { get; set; } = "";
public List<string> ModManifest { get; set; } = new();
}
}