recrownedathenaeum/RecrownedAthenaeum/Pipeline/NinePatchDataReader.cs

18 lines
541 B
C#

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