1
0
mirror of https://github.com/Raymonf/whack.git synced 2024-12-12 16:01:13 +01:00
whack/WTT/UAssetAPI/JSON/UAssetContractResolver.cs

28 lines
757 B
C#
Raw Normal View History

2022-09-29 00:37:28 +02:00
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using UAssetAPI.UnrealTypes;
namespace UAssetAPI.JSON
{
public class UAssetContractResolver : DefaultContractResolver
{
public Dictionary<FName, string> ToBeFilled;
protected override JsonConverter ResolveContractConverter(Type objectType)
{
if (typeof(FName).IsAssignableFrom(objectType))
{
return new FNameJsonConverter(ToBeFilled);
}
return base.ResolveContractConverter(objectType);
}
public UAssetContractResolver(Dictionary<FName, string> toBeFilled) : base()
{
ToBeFilled = toBeFilled;
}
}
}