recrownedgtk/RecrownedAthenaeum/ContentReaders/NinePatchDataReader.cs

18 lines
559 B
C#
Raw Normal View History

using Microsoft.Xna.Framework.Content;
using Newtonsoft.Json;
using System.Text;
2019-01-21 03:45:15 +00:00
namespace RecrownedAthenaeum.ContentReaders
{
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));
}
}
}