27 lines
886 B
C#
27 lines
886 B
C#
using Microsoft.Xna.Framework.Content.Pipeline;
|
|
using Newtonsoft.Json;
|
|
using RecrownedAthenaeum.Data;
|
|
using System.IO;
|
|
|
|
namespace RecrownedAthenaeum.Pipeline.NinePatch
|
|
{
|
|
[ContentImporter(".9p", DisplayName = "Nine Patch Importer", DefaultProcessor = "NinePatchProcessor")]
|
|
internal class NinePatchImporter : ContentImporter<NinePatchImporter.Package>
|
|
{
|
|
public override Package Import(string filename, ContentImporterContext context)
|
|
{
|
|
Package package;
|
|
package.ninePatchData = JsonConvert.DeserializeObject<NinePatchData>(File.ReadAllText(filename));
|
|
package.textureBytes = File.ReadAllBytes(package.ninePatchData.textureName);
|
|
|
|
return package;
|
|
}
|
|
|
|
internal struct Package
|
|
{
|
|
internal byte[] textureBytes;
|
|
internal NinePatchData ninePatchData;
|
|
}
|
|
}
|
|
}
|