WorldItemManagerSaveData.cs 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections.Generic;
  3. using SOTF_Struct.Data;
  4. namespace SOTF_Savegame_Editor.SOTFSave {
  5. public class WorldItemManagerSaveData {
  6. public class DataObject {
  7. public string WorldItemManager { get; set; }
  8. }
  9. public string Version { get; set; }
  10. public DataObject Data { get; set; }
  11. protected WorldItems? _data = null;
  12. public WorldItems? WorldItems {
  13. get {
  14. if (this._data == null) {
  15. System.Text.Json.JsonSerializerOptions options = new() {
  16. NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString | System.Text.Json.Serialization.JsonNumberHandling.AllowNamedFloatingPointLiterals,
  17. AllowTrailingCommas = true,
  18. IgnoreReadOnlyFields = true,
  19. IgnoreReadOnlyProperties = true
  20. };
  21. this._data = System.Text.Json.JsonSerializer.Deserialize<WorldItems>(this.Data.WorldItemManager.Replace("\"NaN\"", "0"), options);
  22. }
  23. return this._data;
  24. }
  25. }
  26. }
  27. }