1
0
mirror of https://github.com/Raymonf/whack.git synced 2024-11-15 05:17:35 +01:00
whack/WTT/UAssetAPI/JSON/FPackageIndexJsonConverter.cs
2022-09-28 18:39:41 -04:00

30 lines
793 B
C#

using Newtonsoft.Json;
using System;
using UAssetAPI.UnrealTypes;
namespace UAssetAPI.JSON
{
public class FPackageIndexJsonConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return objectType == typeof(FPackageIndex);
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
writer.WriteValue((value as FPackageIndex).Index);
}
public override bool CanRead
{
get { return true; }
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
return new FPackageIndex(Convert.ToInt32(reader.Value));
}
}
}