recrownedathenaeum/RecrownedAthenaeum/ContentReaders/NinePatchDataReader.cs
2019-01-20 21:45:15 -06:00

18 lines
559 B
C#

using Microsoft.Xna.Framework.Content;
using Newtonsoft.Json;
using System.Text;
namespace RecrownedAthenaeum.ContentReaders
{
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));
}
}
}