From 5cce238380c651403c048abaeb268c36865e9d6c Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 14 Jan 2020 00:07:52 +0100 Subject: [PATCH] added the ability to only specify a content processor --- Contentless/Contentless.nuspec | 2 +- Contentless/Program.cs | 14 ++++++++------ README.md | 4 +++- Test/Content/Content.mgcb | 8 +++++++- Test/Content/Contentless.json | 3 ++- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Contentless/Contentless.nuspec b/Contentless/Contentless.nuspec index f6b0cfc..c30b360 100644 --- a/Contentless/Contentless.nuspec +++ b/Contentless/Contentless.nuspec @@ -2,7 +2,7 @@ Contentless - 2.0.5 + 2.0.6 Ellpeck A tool for MonoGame that automatically handles adding assets to the Content Pipeline project monogame mono xna content pipeline mgcb builder tool library diff --git a/Contentless/Program.cs b/Contentless/Program.cs index 1619a99..b5d70ea 100644 --- a/Contentless/Program.cs +++ b/Contentless/Program.cs @@ -91,19 +91,21 @@ namespace Contentless { var over = GetOverrideFor(relative, overrides); if (over != null) { // copy special case - if (over.Importer == "Copy") { + if (over.Importer == "Copy" || over.Processor == "Copy") { CopyFile(content, relative); changed = true; continue; } - importer = importers.Find(i => i.Type.Name == over.Importer); - if (importer == null) { - Console.WriteLine($"Override importer {over.Importer} not found for file {relative}"); - continue; + if (!string.IsNullOrEmpty(over.Importer) && over.Importer != "Auto") { + importer = importers.Find(i => i.Type.Name == over.Importer); + if (importer == null) { + Console.WriteLine($"Override importer {over.Importer} not found for file {relative}"); + continue; + } } - if (over.Processor != null) { + if (!string.IsNullOrEmpty(over.Processor) && over.Processor != "Auto") { processor = processors.Find(p => p == over.Processor); if (processor == null) { Console.WriteLine($"Override processor {over.Processor} not found for file {relative}"); diff --git a/README.md b/README.md index 19bb0a3..cd87cde 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,9 @@ To add a configuration file to Contentless, simply create a file named `Contentl // Example: Specifying "Copy" as the importer sets the file's Build Mode to "Copy" instead of "Build" ".txt": "Copy", // Example: Specifying both an importer and a processor - ".ogg": ["OggImporter", "SongProcessor"] + ".ogg": ["OggImporter", "SongProcessor"], + // Example: Only specifying a processor + ".wav": ["Auto", "SoundEffectProcessor"] } } ``` diff --git a/Test/Content/Content.mgcb b/Test/Content/Content.mgcb index 6a74ba6..5f5b102 100644 --- a/Test/Content/Content.mgcb +++ b/Test/Content/Content.mgcb @@ -13,6 +13,7 @@ /reference:..\bin\Debug\netcoreapp2.2\MonoGame.Extended.Content.Pipeline.dll #---------------------------------- Content ---------------------------------# + #begin Json/Copy.json /copy:Json/Copy.json @@ -23,7 +24,7 @@ #begin Locale/Interface.xml /importer:XmlImporter -/processor:PassThroughProcessor +/processor:FontTextureProcessor /build:Locale/Interface.xml #begin Textures/Icons.png @@ -51,3 +52,8 @@ /processor:TiledMapTilesetProcessor /build:Tiled/Tileset.tsx +#begin Textures/Exclude.png +/importer:TextureImporter +/processor:TextureProcessor +/build:Textures/Exclude.png + diff --git a/Test/Content/Contentless.json b/Test/Content/Contentless.json index 4288dad..6356079 100644 --- a/Test/Content/Contentless.json +++ b/Test/Content/Contentless.json @@ -8,6 +8,7 @@ "overrides": { "Copy.*": "Copy", ".json": ["JsonContentImporter", "FontTextureProcessor"], - ".ogg": ["OggImporter", "SongProcessor"] + ".ogg": ["OggImporter", "SongProcessor"], + ".xml": ["", "FontTextureProcessor"] } } \ No newline at end of file