using SOTF_Struct.Data; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Text.Json.Serialization; using System.Text.Json; namespace SOTF_Savegame_Editor.SOTFSave { public class SaveData { public class DataObject { public string HeldOnlyItems { get; set; } public string VillagesAndCaves { get; set; } public string VailWorldSim { get; set; } public string NpcItemInstances { get; set; } } public string Version { get; set; } public DataObject Data { get; set; } protected SaveData_HeldOnlyItems? _data1 = null; protected SaveData_VillagesAndCaves? _data2 = null; protected SaveData_VailWorldSim? _data3 = null; protected SaveData_NpcItemInstances? _data4 = null; public SaveData_HeldOnlyItems? HeldOnlyItems { get { if (this._data1 == null) { JsonSerializerOptions options = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.AllowNamedFloatingPointLiterals, AllowTrailingCommas = true, IgnoreReadOnlyFields = true, IgnoreReadOnlyProperties = true, UnknownTypeHandling = JsonUnknownTypeHandling.JsonNode }; this._data1 = System.Text.Json.JsonSerializer.Deserialize(this.Data.HeldOnlyItems.Replace("\"NaN\"", "0"), options); } return this._data1; } } public SaveData_VillagesAndCaves? VillagesAndCaves { get { if (this._data2 == null) { JsonSerializerOptions options = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.AllowNamedFloatingPointLiterals, AllowTrailingCommas = true, IgnoreReadOnlyFields = true, IgnoreReadOnlyProperties = true, UnknownTypeHandling = JsonUnknownTypeHandling.JsonNode }; this._data2 = System.Text.Json.JsonSerializer.Deserialize(this.Data.VillagesAndCaves.Replace("\"NaN\"", "0"), options); } return this._data2; } } public SaveData_VailWorldSim? VailWorldSim { get { if (this._data3 == null) { JsonSerializerOptions options = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.AllowNamedFloatingPointLiterals, AllowTrailingCommas = true, IgnoreReadOnlyFields = true, IgnoreReadOnlyProperties = true, UnknownTypeHandling = JsonUnknownTypeHandling.JsonNode }; this._data3 = System.Text.Json.JsonSerializer.Deserialize(this.Data.VailWorldSim.Replace("\"NaN\"", "0"), options); } return this._data3; } } public SaveData_NpcItemInstances? NpcItemInstances { get { if (this._data4 == null) { JsonSerializerOptions options = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.AllowNamedFloatingPointLiterals, AllowTrailingCommas = true, IgnoreReadOnlyFields = true, IgnoreReadOnlyProperties = true, UnknownTypeHandling = JsonUnknownTypeHandling.JsonNode }; this._data4 = System.Text.Json.JsonSerializer.Deserialize(this.Data.NpcItemInstances.Replace("\"NaN\"", "0"), options); } return this._data4; } } } }