recrownedgtk/RecrownedAthenaeum/Pipeline/NinePatchDataReader.cs

23 lines
674 B
C#

using Microsoft.Xna.Framework.Content;
using Newtonsoft.Json;
using RecrownedAthenaeum.DataTypes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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));
}
}
}