summaryrefslogtreecommitdiff
path: root/Plugins/MonoGame.Extended/source/MonoGame.Extended.Content.Pipeline/TextureAtlases/TexturePackerJsonImporter.cs
blob: a80e654d47b3b41ef94154271fa373a2d341911d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using System.IO;
using System.Text.Json;
using Microsoft.Xna.Framework.Content.Pipeline;
using MonoGame.Extended.TextureAtlases;


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)
        {
            var json = File.ReadAllText(filename);
            return JsonSerializer.Deserialize<TexturePackerFile>(json);
        }
    }
}