recrownedgtk/RecrownedAthenaeum/Pipeline/NinePatchDataReader.cs
2019-01-15 17:33:55 -06:00

18 lines
553 B
C#

using Microsoft.Xna.Framework.Content;
using Newtonsoft.Json;
using System.Text;
namespace RecrownedAthenaeum.Pipeline
{
class NinePatchDataReader : ContentTypeReader<SpecialTypes.NinePatch>
{
protected override SpecialTypes.NinePatch Read(ContentReader input, SpecialTypes.NinePatch existingInstance)
{
int length = input.ReadInt32();
byte[] bytes = input.ReadBytes(length);
return JsonConvert.DeserializeObject<SpecialTypes.NinePatch>(Encoding.UTF8.GetString(bytes));
}
}
}