diff --git a/BlumAutoBot/BlumBot.csproj b/BlumAutoBot/BlumBot.csproj index be4d8b6..e0e9a85 100644 --- a/BlumAutoBot/BlumBot.csproj +++ b/BlumAutoBot/BlumBot.csproj @@ -6,13 +6,14 @@ enable enable BlumAutoBot - False + True BlumAutoBot Andrii Lavrenko Copyright (c) 2024 Andrii Lavrenko README.md https://github.com/SeRi0uS007/BlumAutoBot LICENSE + 1.0.1 diff --git a/BlumAutoBot/Settings.cs b/BlumAutoBot/Settings.cs index 3d680a4..572f1ac 100644 --- a/BlumAutoBot/Settings.cs +++ b/BlumAutoBot/Settings.cs @@ -1,4 +1,5 @@ using System.Text.Json; +using System.Text.Json.Serialization; namespace BlumBot; @@ -31,7 +32,7 @@ public class Settings Settings? settings; try { - settings = JsonSerializer.Deserialize(file); + settings = JsonSerializer.Deserialize(file, SourceGenerationContext.Default.Settings); } catch (JsonException) { @@ -59,3 +60,9 @@ public static Settings[] ReadSettings() return Directory.GetFiles(settingsPath).Select(x => ReadSettings(x)).Where(x => x != null).ToArray()!; } } + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Settings))] +internal partial class SourceGenerationContext: JsonSerializerContext +{ +}