recrownedgtk/RecrownedAthenaeum/Pipeline/NinePatchDataReader.cs

18 lines
553 B
C#
Raw Normal View History

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