more descriptive display name + set default processors.

This commit is contained in:
Harrison Deng 2019-01-13 17:09:27 -06:00
parent 9df8503f08
commit 7116eb0437
4 changed files with 5 additions and 10 deletions

View File

@ -4,7 +4,7 @@ using System.IO;
namespace RecrownedAthenaeum.Pipeline.NinePatch namespace RecrownedAthenaeum.Pipeline.NinePatch
{ {
[ContentImporter(".9p", DisplayName = "Nine Patch Importer")] [ContentImporter(".9p", DisplayName = "Nine Patch Importer", DefaultProcessor = "NinePatchProcessor")]
internal class NinePatchImporter : ContentImporter<NinePatchData> internal class NinePatchImporter : ContentImporter<NinePatchData>
{ {
public override NinePatchData Import(string filename, ContentImporterContext context) public override NinePatchData Import(string filename, ContentImporterContext context)

View File

@ -4,7 +4,7 @@ using System.Text;
namespace RecrownedAthenaeum.Pipeline.NinePatch namespace RecrownedAthenaeum.Pipeline.NinePatch
{ {
[ContentImporter(DisplayName = "Nine Patch Importer")] [ContentImporter(DisplayName = "Nine Patch Importer - RecrownedAthenaeum")]
class NinePatchProcessor : ContentProcessor<NinePatchData, byte[]> class NinePatchProcessor : ContentProcessor<NinePatchData, byte[]>
{ {
public override byte[] Process(NinePatchData input, ContentProcessorContext context) public override byte[] Process(NinePatchData input, ContentProcessorContext context)

View File

@ -4,16 +4,12 @@ using System.IO;
namespace RecrownedAthenaeum.Pipeline.TextureAtlas namespace RecrownedAthenaeum.Pipeline.TextureAtlas
{ {
[ContentImporter(".tatlas", DisplayName = "Texture Atlas Importer")] [ContentImporter(".tatlas", DisplayName = "Texture Atlas Importer", DefaultProcessor = "TextureAtlasProcessor")]
internal class TextureAtlasImporter : ContentImporter<TextureAtlasData> internal class TextureAtlasImporter : ContentImporter<TextureAtlasData>
{ {
public override TextureAtlasData Import(string filename, ContentImporterContext context) public override TextureAtlasData Import(string filename, ContentImporterContext context)
{ {
TextureAtlasData atlas; TextureAtlasData atlas = JsonConvert.DeserializeObject<TextureAtlasData>(File.ReadAllText(filename));
using (StreamReader stream = new StreamReader(filename))
{
atlas = JsonConvert.DeserializeObject<TextureAtlasData>(stream.ReadToEnd());
}
context.AddDependency(atlas.textureName); context.AddDependency(atlas.textureName);
return atlas; return atlas;
} }

View File

@ -4,10 +4,9 @@ using System.Text;
namespace RecrownedAthenaeum.Pipeline.TextureAtlas namespace RecrownedAthenaeum.Pipeline.TextureAtlas
{ {
[ContentProcessor(DisplayName = "Texture Atlas Processor")] [ContentProcessor(DisplayName = "Texture Atlas Processor - RecrownedAthenaeum")]
class TextureAtlasProcessor : ContentProcessor<TextureAtlasData, byte[]> class TextureAtlasProcessor : ContentProcessor<TextureAtlasData, byte[]>
{ {
public override byte[] Process(TextureAtlasData input, ContentProcessorContext context) public override byte[] Process(TextureAtlasData input, ContentProcessorContext context)
{ {
string serialized = JsonConvert.SerializeObject(input); string serialized = JsonConvert.SerializeObject(input);