added the ability to only specify a content processor

This commit is contained in:
Ellpeck 2020-01-14 00:07:52 +01:00
parent b79601f318
commit 5cce238380
5 changed files with 21 additions and 10 deletions

View file

@ -2,7 +2,7 @@
<package> <package>
<metadata> <metadata>
<id>Contentless</id> <id>Contentless</id>
<version>2.0.5</version> <version>2.0.6</version>
<authors>Ellpeck</authors> <authors>Ellpeck</authors>
<description>A tool for MonoGame that automatically handles adding assets to the Content Pipeline project</description> <description>A tool for MonoGame that automatically handles adding assets to the Content Pipeline project</description>
<tags>monogame mono xna content pipeline mgcb builder tool library</tags> <tags>monogame mono xna content pipeline mgcb builder tool library</tags>

View file

@ -91,19 +91,21 @@ namespace Contentless {
var over = GetOverrideFor(relative, overrides); var over = GetOverrideFor(relative, overrides);
if (over != null) { if (over != null) {
// copy special case // copy special case
if (over.Importer == "Copy") { if (over.Importer == "Copy" || over.Processor == "Copy") {
CopyFile(content, relative); CopyFile(content, relative);
changed = true; changed = true;
continue; continue;
} }
if (!string.IsNullOrEmpty(over.Importer) && over.Importer != "Auto") {
importer = importers.Find(i => i.Type.Name == over.Importer); importer = importers.Find(i => i.Type.Name == over.Importer);
if (importer == null) { if (importer == null) {
Console.WriteLine($"Override importer {over.Importer} not found for file {relative}"); Console.WriteLine($"Override importer {over.Importer} not found for file {relative}");
continue; continue;
} }
}
if (over.Processor != null) { if (!string.IsNullOrEmpty(over.Processor) && over.Processor != "Auto") {
processor = processors.Find(p => p == over.Processor); processor = processors.Find(p => p == over.Processor);
if (processor == null) { if (processor == null) {
Console.WriteLine($"Override processor {over.Processor} not found for file {relative}"); Console.WriteLine($"Override processor {over.Processor} not found for file {relative}");

View file

@ -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" // Example: Specifying "Copy" as the importer sets the file's Build Mode to "Copy" instead of "Build"
".txt": "Copy", ".txt": "Copy",
// Example: Specifying both an importer and a processor // Example: Specifying both an importer and a processor
".ogg": ["OggImporter", "SongProcessor"] ".ogg": ["OggImporter", "SongProcessor"],
// Example: Only specifying a processor
".wav": ["Auto", "SoundEffectProcessor"]
} }
} }
``` ```

View file

@ -13,6 +13,7 @@
/reference:..\bin\Debug\netcoreapp2.2\MonoGame.Extended.Content.Pipeline.dll /reference:..\bin\Debug\netcoreapp2.2\MonoGame.Extended.Content.Pipeline.dll
#---------------------------------- Content ---------------------------------# #---------------------------------- Content ---------------------------------#
#begin Json/Copy.json #begin Json/Copy.json
/copy:Json/Copy.json /copy:Json/Copy.json
@ -23,7 +24,7 @@
#begin Locale/Interface.xml #begin Locale/Interface.xml
/importer:XmlImporter /importer:XmlImporter
/processor:PassThroughProcessor /processor:FontTextureProcessor
/build:Locale/Interface.xml /build:Locale/Interface.xml
#begin Textures/Icons.png #begin Textures/Icons.png
@ -51,3 +52,8 @@
/processor:TiledMapTilesetProcessor /processor:TiledMapTilesetProcessor
/build:Tiled/Tileset.tsx /build:Tiled/Tileset.tsx
#begin Textures/Exclude.png
/importer:TextureImporter
/processor:TextureProcessor
/build:Textures/Exclude.png

View file

@ -8,6 +8,7 @@
"overrides": { "overrides": {
"Copy.*": "Copy", "Copy.*": "Copy",
".json": ["JsonContentImporter", "FontTextureProcessor"], ".json": ["JsonContentImporter", "FontTextureProcessor"],
".ogg": ["OggImporter", "SongProcessor"] ".ogg": ["OggImporter", "SongProcessor"],
".xml": ["", "FontTextureProcessor"]
} }
} }