feat: batch config saves

This commit is contained in:
goat 2022-11-01 19:43:38 +01:00
parent 4769239b19
commit 9c16359914
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
17 changed files with 69 additions and 37 deletions

View file

@ -106,7 +106,7 @@ Thanks and have fun!";
if (this.SafeMode)
{
this.configuration.PluginSafeMode = false;
this.configuration.Save();
this.configuration.QueueSave();
}
this.PluginConfigs = new PluginConfigurations(Path.Combine(Path.GetDirectoryName(this.startInfo.ConfigurationPath) ?? string.Empty, "pluginConfigs"));
@ -409,7 +409,7 @@ Thanks and have fun!";
}
}
this.configuration.Save();
this.configuration.QueueSave();
try
{
@ -716,8 +716,9 @@ Thanks and have fun!";
// Ensure that we have a testing opt-in for this plugin if we are installing a testing version
if (useTesting && this.configuration.PluginTestingOptIns!.All(x => x.InternalName != repoManifest.InternalName))
{
// TODO: this isn't safe
this.configuration.PluginTestingOptIns.Add(new PluginTestingOptIn(repoManifest.InternalName));
this.configuration.Save();
this.configuration.QueueSave();
}
var downloadUrl = useTesting ? repoManifest.DownloadLinkTesting : repoManifest.DownloadLinkInstall;

View file

@ -37,7 +37,7 @@ internal class LocalDevPlugin : LocalPlugin, IDisposable
if (!configuration.DevPluginSettings.TryGetValue(dllFile.FullName, out this.devSettings))
{
configuration.DevPluginSettings[dllFile.FullName] = this.devSettings = new DevPluginSettings();
configuration.Save();
configuration.QueueSave();
}
if (this.AutomaticReload)