diff --git a/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline.csproj b/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline.csproj
index 2aee3f6e..b2b07468 100644
--- a/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline.csproj
+++ b/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline.csproj
@@ -34,6 +34,7 @@
+
@@ -165,6 +166,10 @@
+
+
+
+
diff --git a/ANX.Framework.Content.Pipeline/AnxContentImporterContext.cs b/ANX.Framework.Content.Pipeline/AnxContentImporterContext.cs
new file mode 100644
index 00000000..9267d553
--- /dev/null
+++ b/ANX.Framework.Content.Pipeline/AnxContentImporterContext.cs
@@ -0,0 +1,57 @@
+#region Using Statements
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using ANX.Framework.Content.Pipeline.Tasks;
+
+#endregion
+
+// This file is part of the ANX.Framework created by the
+// "ANX.Framework developer group" and released under the Ms-PL license.
+// For details see: http://anxframework.codeplex.com/license
+
+namespace ANX.Framework.Content.Pipeline
+{
+ public class AnxContentImporterContext : ContentImporterContext
+ {
+ private string intermediateDirectory;
+ private ContentBuildLogger logger;
+ private string outputDirectory;
+
+ public AnxContentImporterContext(BuildContent buildContent, BuildItem buildItem, ContentBuildLogger logger)
+ {
+
+ this.logger = logger;
+ }
+
+ public override string IntermediateDirectory
+ {
+ get
+ {
+ return intermediateDirectory;
+ }
+ }
+
+ public override ContentBuildLogger Logger
+ {
+ get
+ {
+ return Logger;
+ }
+ }
+
+ public override string OutputDirectory
+ {
+ get
+ {
+ return outputDirectory;
+ }
+ }
+
+ public override void AddDependency(string filename)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/ANX.Framework.Content.Pipeline/ContentImporter.cs b/ANX.Framework.Content.Pipeline/ContentImporter.cs
index 1b556eba..9802b76e 100644
--- a/ANX.Framework.Content.Pipeline/ContentImporter.cs
+++ b/ANX.Framework.Content.Pipeline/ContentImporter.cs
@@ -16,15 +16,14 @@ namespace ANX.Framework.Content.Pipeline
{
protected ContentImporter()
{
- throw new NotImplementedException();
+ // nothing to do here
}
public abstract T Import(string filename, ContentImporterContext context);
- Object ANX.Framework.Content.Pipeline.IContentImporter.Import(string filename, ContentImporterContext context)
+ object IContentImporter.Import(string filename, ContentImporterContext context)
{
- throw new NotImplementedException();
+ return this.Import(filename, context);
}
-
}
}
diff --git a/ANX.Framework.Content.Pipeline/ContentImporterContext.cs b/ANX.Framework.Content.Pipeline/ContentImporterContext.cs
index fde7da9b..ea76104a 100644
--- a/ANX.Framework.Content.Pipeline/ContentImporterContext.cs
+++ b/ANX.Framework.Content.Pipeline/ContentImporterContext.cs
@@ -16,7 +16,7 @@ namespace ANX.Framework.Content.Pipeline
{
public ContentImporterContext()
{
- throw new NotImplementedException();
+ //TODO: implement
}
public abstract string IntermediateDirectory { get; }
diff --git a/ANX.Framework.Content.Pipeline/ContentItem.cs b/ANX.Framework.Content.Pipeline/ContentItem.cs
index 334fb883..0cb0dca7 100644
--- a/ANX.Framework.Content.Pipeline/ContentItem.cs
+++ b/ANX.Framework.Content.Pipeline/ContentItem.cs
@@ -16,7 +16,7 @@ namespace ANX.Framework.Content.Pipeline
{
public ContentItem()
{
- throw new NotImplementedException();
+ // nothing to do here
}
public ContentIdentity Identity
diff --git a/ANX.Framework.Content.Pipeline/EffectImporter.cs b/ANX.Framework.Content.Pipeline/EffectImporter.cs
index b36d919d..d6c135b7 100644
--- a/ANX.Framework.Content.Pipeline/EffectImporter.cs
+++ b/ANX.Framework.Content.Pipeline/EffectImporter.cs
@@ -13,6 +13,7 @@ using ANX.Framework.Content.Pipeline.Graphics;
namespace ANX.Framework.Content.Pipeline
{
+ [ContentImporter(".fx")]
public class EffectImporter : ContentImporter
{
public EffectImporter()
@@ -21,7 +22,13 @@ namespace ANX.Framework.Content.Pipeline
public override EffectContent Import(string filename, ContentImporterContext context)
{
- throw new NotImplementedException();
+ EffectContent content = new EffectContent()
+ {
+ EffectCode = System.IO.File.ReadAllText(filename),
+ Identity = new ContentIdentity(filename, null, null),
+ };
+
+ return content;
}
}
}
diff --git a/ANX.Framework.Content.Pipeline/FbxImporter.cs b/ANX.Framework.Content.Pipeline/FbxImporter.cs
index db5e11f1..721a03f8 100644
--- a/ANX.Framework.Content.Pipeline/FbxImporter.cs
+++ b/ANX.Framework.Content.Pipeline/FbxImporter.cs
@@ -13,6 +13,7 @@ using ANX.Framework.Content.Pipeline.Graphics;
namespace ANX.Framework.Content.Pipeline
{
+ [ContentImporter]
public class FbxImporter : ContentImporter
{
public FbxImporter()
diff --git a/ANX.Framework.Content.Pipeline/Tasks/BuildContent.cs b/ANX.Framework.Content.Pipeline/Tasks/BuildContent.cs
new file mode 100644
index 00000000..420c12f5
--- /dev/null
+++ b/ANX.Framework.Content.Pipeline/Tasks/BuildContent.cs
@@ -0,0 +1,51 @@
+#region Using Statements
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+#endregion
+
+// This file is part of the ANX.Framework created by the
+// "ANX.Framework developer group" and released under the Ms-PL license.
+// For details see: http://anxframework.codeplex.com/license
+
+namespace ANX.Framework.Content.Pipeline.Tasks
+{
+ public class BuildContent
+ {
+ private ImporterManager importerManager;
+
+ public ImporterManager ImporterManager
+ {
+ get
+ {
+ if (this.importerManager == null)
+ {
+ this.importerManager = new ImporterManager();
+ }
+ return this.importerManager;
+ }
+ }
+
+ public void Execute(IEnumerable itemsToBuild)
+ {
+ foreach (BuildItem buildItem in itemsToBuild)
+ {
+ var importedObject = ImportAsset(buildItem);
+ }
+ }
+
+ private object ImportAsset(BuildItem item)
+ {
+ IContentImporter instance = this.ImporterManager.GetInstance(item.BuildRequest.ImporterName);
+ ContentImporterContext context = new AnxContentImporterContext(this, item, null); //this.buildLogger);
+ //this.buildLogger.LogMessage(Resources.BuildLogImporting, new object[]
+ //{
+ // item.BuildRequest.SourceFilename,
+ // instance.GetType()
+ //});
+ return instance.Import(item.BuildRequest.SourceFilename, context);
+ }
+ }
+}
diff --git a/ANX.Framework.Content.Pipeline/Tasks/BuildItem.cs b/ANX.Framework.Content.Pipeline/Tasks/BuildItem.cs
new file mode 100644
index 00000000..d3ec52a8
--- /dev/null
+++ b/ANX.Framework.Content.Pipeline/Tasks/BuildItem.cs
@@ -0,0 +1,24 @@
+#region Using Statements
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+#endregion
+
+// This file is part of the ANX.Framework created by the
+// "ANX.Framework developer group" and released under the Ms-PL license.
+// For details see: http://anxframework.codeplex.com/license
+
+namespace ANX.Framework.Content.Pipeline.Tasks
+{
+ public class BuildItem
+ {
+ public BuildRequest BuildRequest
+ {
+ get;
+ set;
+ }
+
+ }
+}
diff --git a/ANX.Framework.Content.Pipeline/Tasks/BuildRequest.cs b/ANX.Framework.Content.Pipeline/Tasks/BuildRequest.cs
new file mode 100644
index 00000000..2a941967
--- /dev/null
+++ b/ANX.Framework.Content.Pipeline/Tasks/BuildRequest.cs
@@ -0,0 +1,23 @@
+#region Using Statements
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+#endregion
+
+// This file is part of the ANX.Framework created by the
+// "ANX.Framework developer group" and released under the Ms-PL license.
+// For details see: http://anxframework.codeplex.com/license
+
+namespace ANX.Framework.Content.Pipeline.Tasks
+{
+ public class BuildRequest
+ {
+ public String SourceFilename;
+ public String AssetName;
+ public string ImporterName;
+ public string ProcessorName;
+
+ }
+}
diff --git a/ANX.Framework.Content.Pipeline/Tasks/ImporterManager.cs b/ANX.Framework.Content.Pipeline/Tasks/ImporterManager.cs
new file mode 100644
index 00000000..0490bdc4
--- /dev/null
+++ b/ANX.Framework.Content.Pipeline/Tasks/ImporterManager.cs
@@ -0,0 +1,70 @@
+#region Using Statements
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Reflection;
+
+#endregion
+
+// This file is part of the ANX.Framework created by the
+// "ANX.Framework developer group" and released under the Ms-PL license.
+// For details see: http://anxframework.codeplex.com/license
+
+namespace ANX.Framework.Content.Pipeline.Tasks
+{
+ public class ImporterManager
+ {
+ private Dictionary importerTypes = new Dictionary();
+
+ public ImporterManager()
+ {
+ foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
+ {
+ foreach (Type type in assembly.GetTypes())
+ {
+ ContentImporterAttribute[] value = (ContentImporterAttribute[]) type.GetCustomAttributes(typeof(ContentImporterAttribute), true);
+ if (value.Length > 0)
+ {
+ importerTypes[type.Name] = type;
+ }
+ }
+ }
+ }
+
+ public IContentImporter GetInstance(string importerName)
+ {
+ Type type;
+ if (!this.importerTypes.TryGetValue(importerName, out type))
+ {
+ throw new Exception(String.Format("can't find importer {0}", importerName));
+ }
+ return (IContentImporter)Activator.CreateInstance(type);
+ }
+
+ public static String GuessImporterByFileExtension(string filename)
+ {
+ String extension = System.IO.Path.GetExtension(filename);
+
+ foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
+ {
+ foreach (Type type in assembly.GetTypes())
+ {
+ ContentImporterAttribute[] value = (ContentImporterAttribute[])type.GetCustomAttributes(typeof(ContentImporterAttribute), true);
+ foreach (ContentImporterAttribute cia in value)
+ {
+ foreach (string fe in cia.FileExtensions)
+ {
+ if (string.Equals(fe, extension, StringComparison.InvariantCultureIgnoreCase))
+ {
+ return type.Name;
+ }
+ }
+ }
+ }
+ }
+
+ return String.Empty;
+ }
+ }
+}
diff --git a/ANX.Framework.sln b/ANX.Framework.sln
index 6e3c7700..5602cdf9 100644
--- a/ANX.Framework.sln
+++ b/ANX.Framework.sln
@@ -170,6 +170,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Metro", "Metro", "{32B91ACB
shader\Metro\SpriteBatch.fx = shader\Metro\SpriteBatch.fx
EndProjectSection
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ContentBuilder", "Tools\ContentBuilder\ContentBuilder.csproj", "{10F7894D-E8B5-4DCA-BB08-5C99FA792388}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -638,6 +640,16 @@ Global
{47B802CC-069D-431E-BF15-E574EDD3BA5D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{47B802CC-069D-431E-BF15-E574EDD3BA5D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{47B802CC-069D-431E-BF15-E574EDD3BA5D}.Release|x86.ActiveCfg = Release|Any CPU
+ {10F7894D-E8B5-4DCA-BB08-5C99FA792388}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {10F7894D-E8B5-4DCA-BB08-5C99FA792388}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {10F7894D-E8B5-4DCA-BB08-5C99FA792388}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {10F7894D-E8B5-4DCA-BB08-5C99FA792388}.Debug|x86.ActiveCfg = Debug|x86
+ {10F7894D-E8B5-4DCA-BB08-5C99FA792388}.Debug|x86.Build.0 = Debug|x86
+ {10F7894D-E8B5-4DCA-BB08-5C99FA792388}.Release|Any CPU.ActiveCfg = Release|x86
+ {10F7894D-E8B5-4DCA-BB08-5C99FA792388}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {10F7894D-E8B5-4DCA-BB08-5C99FA792388}.Release|Mixed Platforms.Build.0 = Release|x86
+ {10F7894D-E8B5-4DCA-BB08-5C99FA792388}.Release|x86.ActiveCfg = Release|x86
+ {10F7894D-E8B5-4DCA-BB08-5C99FA792388}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -649,6 +661,7 @@ Global
{9588B0C3-E03A-4C71-89A4-2C8685D426F1} = {B24A8593-562A-4A25-BB08-46C163F10F3F}
{F9177943-1590-49AE-987D-D6FAE30D96DD} = {B24A8593-562A-4A25-BB08-46C163F10F3F}
{47B802CC-069D-431E-BF15-E574EDD3BA5D} = {B24A8593-562A-4A25-BB08-46C163F10F3F}
+ {10F7894D-E8B5-4DCA-BB08-5C99FA792388} = {B24A8593-562A-4A25-BB08-46C163F10F3F}
{5BE49183-2F6F-4527-AC90-D816911FCF90} = {D421509A-9AE3-4D7E-881B-EAFED598B028}
{EB8258E0-6741-4DB9-B756-1EBDF67B1ED6} = {D421509A-9AE3-4D7E-881B-EAFED598B028}
{B30DE9C2-0926-46B6-8351-9AF276C472D5} = {D421509A-9AE3-4D7E-881B-EAFED598B028}
diff --git a/Tools/ContentBuilder/ContentBuilder.csproj b/Tools/ContentBuilder/ContentBuilder.csproj
new file mode 100644
index 00000000..b35cac74
--- /dev/null
+++ b/Tools/ContentBuilder/ContentBuilder.csproj
@@ -0,0 +1,63 @@
+
+
+
+ Debug
+ x86
+ 8.0.30703
+ 2.0
+ {10F7894D-E8B5-4DCA-BB08-5C99FA792388}
+ Exe
+ Properties
+ ContentBuilder
+ ContentBuilder
+ v4.0
+ Client
+ 512
+
+
+ x86
+ true
+ full
+ false
+ ..\..\bin\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ x86
+ pdbonly
+ true
+ ..\..\bin\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {2DAFDFC1-223B-4741-87BB-BE3D0A7617DB}
+ ANX.Framework.Content.Pipeline
+
+
+
+
+
\ No newline at end of file
diff --git a/Tools/ContentBuilder/Program.cs b/Tools/ContentBuilder/Program.cs
new file mode 100644
index 00000000..d8413690
--- /dev/null
+++ b/Tools/ContentBuilder/Program.cs
@@ -0,0 +1,46 @@
+#region Using Statements
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using ANX.Framework.Content.Pipeline.Tasks;
+
+#endregion
+
+// This file is part of the ANX.Framework created by the
+// "ANX.Framework developer group" and released under the Ms-PL license.
+// For details see: http://anxframework.codeplex.com/license
+
+namespace ContentBuilder
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ //
+ // Generate a list of items to build and set build parameters
+ //
+ List itemsToBuild = new List();
+
+ foreach (string arg in args)
+ {
+ if (!arg.StartsWith("/") && !arg.StartsWith("-"))
+ {
+ BuildItem buildItem = new BuildItem();
+ buildItem.BuildRequest = new BuildRequest();
+ buildItem.BuildRequest.ImporterName = ImporterManager.GuessImporterByFileExtension(arg);
+ buildItem.BuildRequest.SourceFilename = arg;
+ buildItem.BuildRequest.AssetName = System.IO.Path.GetFileNameWithoutExtension(arg);
+
+ itemsToBuild.Add(buildItem);
+ }
+ }
+
+ //
+ // Build the content
+ //
+ BuildContent buildContentTask = new BuildContent();
+ buildContentTask.Execute(itemsToBuild);
+ }
+ }
+}
diff --git a/Tools/ContentBuilder/Properties/AssemblyInfo.cs b/Tools/ContentBuilder/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..87a1549d
--- /dev/null
+++ b/Tools/ContentBuilder/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Allgemeine Informationen über eine Assembly werden über die folgenden
+// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
+// die mit einer Assembly verknüpft sind.
+[assembly: AssemblyTitle("ContentBuilder")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("ANX Developer Team")]
+[assembly: AssemblyProduct("ContentBuilder")]
+[assembly: AssemblyCopyright("Copyright © ANX Developer Team 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
+// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
+// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
+[assembly: ComVisible(false)]
+
+// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
+[assembly: Guid("1ae48f9d-83a9-4a93-bc9b-7a51a501a42b")]
+
+// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
+//
+// Hauptversion
+// Nebenversion
+// Buildnummer
+// Revision
+//
+// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
+// übernehmen, indem Sie "*" eingeben:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("0.1.0.0")]
+[assembly: AssemblyFileVersion("0.1.0.0")]