PlayerArmourSystemSaveData.cs 1.2 KB

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