Added options to disable launcher/plugin auto updates
All checks were successful
Build / Compute Version (push) Successful in 6s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 4m4s
Build / Build Nuget package (NuGet) (push) Successful in 4m7s
Build / Build Nuget package (SharedCringe) (push) Successful in 4m5s
Build / Build Nuget package (CringePlugins) (push) Successful in 4m25s
Build / Build Launcher (push) Successful in 5m12s

Also ran cleanup
This commit is contained in:
2025-06-06 01:35:09 -04:00
parent bc88f0c28a
commit 94fc8a55c0
48 changed files with 381 additions and 267 deletions

View File

@@ -9,16 +9,18 @@ namespace CringePlugins.Config;
public sealed class ConfigHandler
{
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
private readonly DirectoryInfo _configDirectory;
private readonly JsonSerializerOptions _serializerOptions = new(NuGetClient.SerializerOptions)
public static readonly JsonSerializerOptions SerializerOptions = new(NuGetClient.SerializerOptions)
{
WriteIndented = true,
AllowTrailingCommas = true,
ReadCommentHandling = JsonCommentHandling.Skip
};
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
private readonly DirectoryInfo _configDirectory;
private readonly EvaluationOptions _evaluationOptions = new()
{
OutputFormat = OutputFormat.List,
@@ -67,7 +69,7 @@ public sealed class ConfigHandler
T instance;
try
{
instance = jsonNode.Deserialize<T>(_serializerOptions)!;
instance = jsonNode.Deserialize<T>(SerializerOptions)!;
}
catch (JsonException e)
{
@@ -84,7 +86,7 @@ public sealed class ConfigHandler
{
var spec = IConfigurationSpecProvider.FromType(typeof(T));
var jsonNode = JsonSerializer.SerializeToNode(newValue, _serializerOptions)!;
var jsonNode = JsonSerializer.SerializeToNode(newValue, SerializerOptions)!;
if (spec != null && !TryValidate(name, spec, jsonNode))
throw new JsonException($"Supplied config value for {name} is invalid");
@@ -96,7 +98,7 @@ public sealed class ConfigHandler
{
Indented = true
});
jsonNode.WriteTo(writer, _serializerOptions);
jsonNode.WriteTo(writer, SerializerOptions);
ConfigReloaded?.Invoke(this, new ConfigValue<T>(name, newValue));
}