mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-24 12:06:37 +00:00
24 lines
900 B
C#
24 lines
900 B
C#
using System.IO;
|
|
using Microsoft.Xna.Framework.Content.Pipeline;
|
|
using MonoGame.Extended.TextureAtlases;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace MonoGame.Extended.Content.Pipeline.TextureAtlases
|
|
{
|
|
[ContentImporter(".json", DefaultProcessor = "TexturePackerProcessor",
|
|
DisplayName = "TexturePacker JSON Importer - MonoGame.Extended")]
|
|
public class TexturePackerJsonImporter : ContentImporter<TexturePackerFile>
|
|
{
|
|
public override TexturePackerFile Import(string filename, ContentImporterContext context)
|
|
{
|
|
using (var streamReader = new StreamReader(filename))
|
|
{
|
|
using (var jsonReader = new JsonTextReader(streamReader))
|
|
{
|
|
var serializer = new JsonSerializer();
|
|
return serializer.Deserialize<TexturePackerFile>(jsonReader);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |