mirror of
https://github.com/sp-tarkov/assembly-tool.git
synced 2025-02-13 01:30:45 -05:00
Fix item.json loading
This commit is contained in:
parent
de0b632426
commit
2589d0d3bc
@ -1,9 +1,12 @@
|
|||||||
namespace ReCodeItLib.Models;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace ReCodeItLib.Models;
|
||||||
|
|
||||||
public class ItemTemplateModel
|
public class ItemTemplateModel
|
||||||
{
|
{
|
||||||
public string? _id;
|
[JsonPropertyName("_id")]
|
||||||
public string? _name;
|
public string? Id { get; set; }
|
||||||
public string? _parent;
|
|
||||||
public string? _type;
|
[JsonPropertyName("_name")]
|
||||||
|
public string? Name { get; set; }
|
||||||
}
|
}
|
@ -274,10 +274,12 @@ public class ReMapper
|
|||||||
var remap = new RemapModel
|
var remap = new RemapModel
|
||||||
{
|
{
|
||||||
OriginalTypeName = type.Value.Name,
|
OriginalTypeName = type.Value.Name,
|
||||||
NewTypeName = $"{template._name}{extName}",
|
NewTypeName = $"{template.Name}{extName}",
|
||||||
UseForceRename = true
|
UseForceRename = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Logger.LogSync($"{type.Value.Name} -> {template.Name}{extName}");
|
||||||
|
|
||||||
_remaps.Add(remap);
|
_remaps.Add(remap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using dnlib.DotNet;
|
using dnlib.DotNet;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using ReCodeItLib.Models;
|
using ReCodeItLib.Models;
|
||||||
|
using JsonSerializer = System.Text.Json.JsonSerializer;
|
||||||
|
|
||||||
namespace ReCodeItLib.Utils;
|
namespace ReCodeItLib.Utils;
|
||||||
|
|
||||||
@ -92,6 +94,12 @@ public static class DataProvider
|
|||||||
var itemsPath = Path.Combine(DataPath, "items.json");
|
var itemsPath = Path.Combine(DataPath, "items.json");
|
||||||
var jsonText = File.ReadAllText(itemsPath);
|
var jsonText = File.ReadAllText(itemsPath);
|
||||||
|
|
||||||
return JsonSerializer.Deserialize<Dictionary<string, ItemTemplateModel>>(jsonText)!;
|
JsonSerializerOptions settings = new()
|
||||||
|
{
|
||||||
|
RespectNullableAnnotations = true,
|
||||||
|
PropertyNameCaseInsensitive = true
|
||||||
|
};
|
||||||
|
|
||||||
|
return JsonSerializer.Deserialize<Dictionary<string, ItemTemplateModel>>(jsonText, settings)!;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user