diff --git a/Build/Contentless.exe b/Build/Contentless.exe
index 1529e3e..9e376da 100644
Binary files a/Build/Contentless.exe and b/Build/Contentless.exe differ
diff --git a/Build/Contentless.pdb b/Build/Contentless.pdb
index 56e4655..960a7dc 100644
Binary files a/Build/Contentless.pdb and b/Build/Contentless.pdb differ
diff --git a/Build/MonoGame.Framework.Content.Pipeline.dll b/Build/MonoGame.Framework.Content.Pipeline.dll
index 76c409d..44feab2 100644
Binary files a/Build/MonoGame.Framework.Content.Pipeline.dll and b/Build/MonoGame.Framework.Content.Pipeline.dll differ
diff --git a/Build/MonoGame.Framework.Content.Pipeline.pdb b/Build/MonoGame.Framework.Content.Pipeline.pdb
deleted file mode 100644
index f0e47a5..0000000
Binary files a/Build/MonoGame.Framework.Content.Pipeline.pdb and /dev/null differ
diff --git a/Build/MonoGame.Framework.dll b/Build/MonoGame.Framework.dll
index 579600c..cdd6867 100644
Binary files a/Build/MonoGame.Framework.dll and b/Build/MonoGame.Framework.dll differ
diff --git a/Build/MonoGame.Framework.pdb b/Build/MonoGame.Framework.pdb
deleted file mode 100644
index 73a23b9..0000000
Binary files a/Build/MonoGame.Framework.pdb and /dev/null differ
diff --git a/Contentless/ImporterInfo.cs b/Contentless/ImporterInfo.cs
new file mode 100644
index 0000000..9ca6630
--- /dev/null
+++ b/Contentless/ImporterInfo.cs
@@ -0,0 +1,20 @@
+using System;
+using Microsoft.Xna.Framework.Content.Pipeline;
+
+namespace Contentless {
+ public class ImporterInfo {
+
+ public readonly ContentImporterAttribute Importer;
+ public readonly Type Type;
+
+ public ImporterInfo(ContentImporterAttribute importer, Type type) {
+ this.Importer = importer;
+ this.Type = type;
+ }
+
+ public override string ToString() {
+ return this.Type.Name;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Contentless/Program.cs b/Contentless/Program.cs
index b8dcc85..553440c 100644
--- a/Contentless/Program.cs
+++ b/Contentless/Program.cs
@@ -8,7 +8,6 @@ using Microsoft.Xna.Framework.Content.Pipeline;
namespace Contentless {
public static class Program {
- private static readonly ImporterInfo[] Importers = GetContentImporters().ToArray();
private static readonly string[] ExcludedFolders = {"bin/", "obj/"};
public static void Main(string[] args) {
@@ -16,22 +15,40 @@ namespace Contentless {
Console.WriteLine("Please specify the location of the content file you want to use");
return;
}
-
+
var contentFile = new FileInfo(Path.Combine(Environment.CurrentDirectory, args[0]));
if (!contentFile.Exists) {
Console.WriteLine($"Unable to find content file {contentFile}");
return;
}
-
+
Console.WriteLine($"Using content file {contentFile}");
var content = ReadContent(contentFile);
+ // load any references to be able to include custom content types as well
+ foreach (var line in content) {
+ if (!line.StartsWith("/reference:"))
+ continue;
+ var reference = line.Substring(11);
+ var refPath = Path.Combine(contentFile.DirectoryName, reference);
+ try {
+ Assembly.LoadFrom(refPath);
+ Console.WriteLine($"Using reference {refPath}");
+ } catch (Exception) {
+ Console.WriteLine($"Couldn't load reference {refPath}, file types that require this reference won't be added automatically");
+ }
+ }
+
+ // load content importers
+ var importers = GetContentImporters().ToArray();
+ Console.WriteLine($"Found possible importer types {string.Join(", ", importers.AsEnumerable())}");
+
var changed = false;
foreach (var file in contentFile.Directory.EnumerateFiles("*", SearchOption.AllDirectories)) {
// is the file the content file?
if (file.Name == contentFile.Name)
continue;
- var relative = GetRelativePath(contentFile.Directory.FullName, file.FullName);
+ var relative = GetRelativePath(contentFile.DirectoryName, file.FullName).Replace("\\", "/");
// is the file in an excluded directory?
if (ExcludedFolders.Any(e => relative.Contains(e))) {
@@ -44,9 +61,9 @@ namespace Contentless {
continue;
}
- var importer = GetImporterFor(relative);
+ var importer = GetImporterFor(relative, importers);
if (importer == null) {
- Console.WriteLine($"No importer found for file {relative}, please add the file manually");
+ Console.WriteLine($"No importer found for file {relative}");
continue;
}
@@ -75,9 +92,9 @@ namespace Contentless {
}
}
- private static ImporterInfo GetImporterFor(string file) {
+ private static ImporterInfo GetImporterFor(string file, ImporterInfo[] importers) {
var extension = Path.GetExtension(file);
- foreach (var importer in Importers) {
+ foreach (var importer in importers) {
if (importer.Importer.FileExtensions.Contains(extension))
return importer;
}
@@ -114,25 +131,11 @@ namespace Contentless {
}
private static string GetRelativePath(string relativeTo, string path) {
- relativeTo = relativeTo.Replace("\\", "/");
- path = path.Replace("\\", "/");
-
- if (!relativeTo.EndsWith("/"))
- relativeTo += '/';
+ if (!relativeTo.EndsWith(Path.DirectorySeparatorChar.ToString()))
+ relativeTo += Path.DirectorySeparatorChar;
return path.Replace(relativeTo, "");
}
- private class ImporterInfo {
-
- public readonly ContentImporterAttribute Importer;
- public readonly Type Type;
-
- public ImporterInfo(ContentImporterAttribute importer, Type type) {
- this.Importer = importer;
- this.Type = type;
- }
-
- }
-
}
+
}
\ No newline at end of file
diff --git a/Test/Content/Content.mgcb b/Test/Content/Content.mgcb
index d78753e..3a18093 100644
--- a/Test/Content/Content.mgcb
+++ b/Test/Content/Content.mgcb
@@ -10,14 +10,10 @@
#-------------------------------- References --------------------------------#
+/reference:..\bin\Debug\netcoreapp2.2\MonoGame.Extended.Content.Pipeline.dll
#---------------------------------- Content ---------------------------------#
-#begin Textures/Inside.png
-/importer:TextureImporter
-/processor:TextureProcessor
-/build:Textures/Inside.png
-
#begin Locale/Interface.xml
/importer:XmlImporter
/processor:PassThroughProcessor
@@ -26,5 +22,46 @@
#begin Textures/Icons.png
/importer:TextureImporter
/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
/build:Textures/Icons.png
+#begin Textures/Inside.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:Textures/Inside.png
+
+#begin Tiled/Map.tmx
+/importer:TiledMapImporter
+/processor:TiledMapProcessor
+/build:Tiled/Map.tmx
+
+#begin Tiled/Tiles.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:Tiled/Tiles.png
+
+#begin Tiled/Tileset.tsx
+/importer:TiledMapTilesetImporter
+/processor:TiledMapTilesetProcessor
+/build:Tiled/Tileset.tsx
+
diff --git a/Test/Content/Tiled/Map.tmx b/Test/Content/Tiled/Map.tmx
new file mode 100644
index 0000000..684e5dd
--- /dev/null
+++ b/Test/Content/Tiled/Map.tmx
@@ -0,0 +1,274 @@
+
+
diff --git a/Test/Content/Tiled/Tiles.png b/Test/Content/Tiled/Tiles.png
new file mode 100644
index 0000000..16894a8
Binary files /dev/null and b/Test/Content/Tiled/Tiles.png differ
diff --git a/Test/Content/Tiled/Tileset.tsx b/Test/Content/Tiled/Tileset.tsx
new file mode 100644
index 0000000..4109ccb
--- /dev/null
+++ b/Test/Content/Tiled/Tileset.tsx
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Test/Test.csproj b/Test/Test.csproj
index ec0b0b9..fd7b2c0 100644
--- a/Test/Test.csproj
+++ b/Test/Test.csproj
@@ -2,6 +2,15 @@
netcoreapp2.2
+ true
+
+
+
+
+
+
+
+