mirror of
https://github.com/sp-tarkov/assembly-tool.git
synced 2025-02-13 01:50:45 -05:00
Fix json serializer
This commit is contained in:
parent
8ec4b245bb
commit
e6364092aa
@ -1,5 +1,5 @@
|
|||||||
using dnlib.DotNet;
|
using System.Text.Json.Serialization;
|
||||||
using Newtonsoft.Json;
|
using dnlib.DotNet;
|
||||||
using ReCodeItLib.Enums;
|
using ReCodeItLib.Enums;
|
||||||
|
|
||||||
namespace ReCodeItLib.Models;
|
namespace ReCodeItLib.Models;
|
||||||
@ -15,7 +15,8 @@ public class RemapModel
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public List<ENoMatchReason> NoMatchReasons { get; set; } = [];
|
public List<ENoMatchReason> NoMatchReasons { get; set; } = [];
|
||||||
|
|
||||||
[JsonIgnore] public string AmbiguousTypeMatch { get; set; } = string.Empty;
|
[JsonIgnore]
|
||||||
|
public string AmbiguousTypeMatch { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is a list of type candidates that made it through the filter
|
/// This is a list of type candidates that made it through the filter
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using dnlib.DotNet;
|
using dnlib.DotNet;
|
||||||
using ReCodeItLib.Models;
|
using ReCodeItLib.Models;
|
||||||
|
|
||||||
@ -28,7 +29,12 @@ public static class DataProvider
|
|||||||
|
|
||||||
var jsonText = File.ReadAllText(path);
|
var jsonText = File.ReadAllText(path);
|
||||||
|
|
||||||
var remaps = JsonSerializer.Deserialize<List<RemapModel>>(jsonText);
|
JsonSerializerOptions settings = new()
|
||||||
|
{
|
||||||
|
AllowTrailingCommas = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
var remaps = JsonSerializer.Deserialize<List<RemapModel>>(jsonText, settings);
|
||||||
|
|
||||||
return remaps ?? [];
|
return remaps ?? [];
|
||||||
}
|
}
|
||||||
@ -43,7 +49,7 @@ public static class DataProvider
|
|||||||
JsonSerializerOptions settings = new()
|
JsonSerializerOptions settings = new()
|
||||||
{
|
{
|
||||||
WriteIndented = true,
|
WriteIndented = true,
|
||||||
RespectNullableAnnotations = ignoreNull
|
RespectNullableAnnotations = ignoreNull,
|
||||||
};
|
};
|
||||||
|
|
||||||
var jsonText = JsonSerializer.Serialize(remaps, settings);
|
var jsonText = JsonSerializer.Serialize(remaps, settings);
|
||||||
@ -73,7 +79,12 @@ public static class DataProvider
|
|||||||
var settingsPath = Path.Combine(DataPath, "Settings.jsonc");
|
var settingsPath = Path.Combine(DataPath, "Settings.jsonc");
|
||||||
var jsonText = File.ReadAllText(settingsPath);
|
var jsonText = File.ReadAllText(settingsPath);
|
||||||
|
|
||||||
return JsonSerializer.Deserialize<Settings>(jsonText)!;
|
JsonSerializerOptions settings = new()
|
||||||
|
{
|
||||||
|
AllowTrailingCommas = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
return JsonSerializer.Deserialize<Settings>(jsonText, settings)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Dictionary<string, ItemTemplateModel> LoadItems()
|
private static Dictionary<string, ItemTemplateModel> LoadItems()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user