From 91e6bff34cc30a2d8c321b9d2e5435e9a73d46fd Mon Sep 17 00:00:00 2001 From: Glatzemann Date: Thu, 16 Aug 2012 07:30:59 +0000 Subject: [PATCH] added some more classes to our own ContentPipeline implementation --- .../ANX.Framework.Content.Pipeline.csproj | 15 ++ .../ChildCollection.cs | 56 +++++++ .../ContentBuildLogger.cs | 41 +++++ .../ContentIdentity.cs | 59 +++++++ .../ContentImporter.cs | 28 ++++ .../ContentImporterAttribute.cs | 51 ++++++ .../ContentImporterContext.cs | 27 ++++ ANX.Framework.Content.Pipeline/ContentItem.cs | 42 +++++ .../ContentProcessor.cs | 39 +++++ .../ContentProcessorAttribute.cs | 27 ++++ .../ContextProcessorContext.cs | 57 +++++++ .../ExternalReference.cs | 38 +++++ .../IContentImporter.cs | 16 ++ .../IContentProcessor.cs | 21 +++ .../NamedValueDictionary.cs | 145 ++++++++++++++++++ .../Compiler/BuiltInTypeWriter.cs | 9 +- 16 files changed, 670 insertions(+), 1 deletion(-) create mode 100644 ANX.Framework.Content.Pipeline/ChildCollection.cs create mode 100644 ANX.Framework.Content.Pipeline/ContentBuildLogger.cs create mode 100644 ANX.Framework.Content.Pipeline/ContentIdentity.cs create mode 100644 ANX.Framework.Content.Pipeline/ContentImporter.cs create mode 100644 ANX.Framework.Content.Pipeline/ContentImporterAttribute.cs create mode 100644 ANX.Framework.Content.Pipeline/ContentImporterContext.cs create mode 100644 ANX.Framework.Content.Pipeline/ContentItem.cs create mode 100644 ANX.Framework.Content.Pipeline/ContentProcessor.cs create mode 100644 ANX.Framework.Content.Pipeline/ContentProcessorAttribute.cs create mode 100644 ANX.Framework.Content.Pipeline/ContextProcessorContext.cs create mode 100644 ANX.Framework.Content.Pipeline/ExternalReference.cs create mode 100644 ANX.Framework.Content.Pipeline/IContentImporter.cs create mode 100644 ANX.Framework.Content.Pipeline/IContentProcessor.cs create mode 100644 ANX.Framework.Content.Pipeline/NamedValueDictionary.cs diff --git a/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline.csproj b/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline.csproj index 5e8615ce..d1d757f1 100644 --- a/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline.csproj +++ b/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline.csproj @@ -34,6 +34,21 @@ + + + + + + + + + + + + + + + diff --git a/ANX.Framework.Content.Pipeline/ChildCollection.cs b/ANX.Framework.Content.Pipeline/ChildCollection.cs new file mode 100644 index 00000000..89e7ef9d --- /dev/null +++ b/ANX.Framework.Content.Pipeline/ChildCollection.cs @@ -0,0 +1,56 @@ +#region Using Statements +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Collections.ObjectModel; + +#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 abstract class ChildCollection : Collection where TParent : class where TChild : class + { + protected ChildCollection(TParent parent) + { + throw new NotImplementedException(); + } + + protected override void ClearItems() + { + base.ClearItems(); + + throw new NotImplementedException(); + } + + protected abstract TParent GetParent(TChild child); + + protected override void InsertItem(int index, TChild item) + { + base.InsertItem(index, item); + + throw new NotImplementedException(); + } + + protected override void RemoveItem(int index) + { + base.RemoveItem(index); + + throw new NotImplementedException(); + } + + protected override void SetItem(int index, TChild item) + { + base.SetItem(index, item); + + throw new NotImplementedException(); + } + + protected abstract void SetParent(TChild child, TParent parent); + + } +} diff --git a/ANX.Framework.Content.Pipeline/ContentBuildLogger.cs b/ANX.Framework.Content.Pipeline/ContentBuildLogger.cs new file mode 100644 index 00000000..9c139fbb --- /dev/null +++ b/ANX.Framework.Content.Pipeline/ContentBuildLogger.cs @@ -0,0 +1,41 @@ +#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 +{ + public abstract class ContentBuildLogger + { + protected ContentBuildLogger() + { + throw new NotImplementedException(); + } + + public abstract void LogImportantMessage(string message, params Object[] messageArgs); + public abstract void LogMessage(string message, params Object[] messageArgs); + public abstract void LogWarning(string helpLink, ContentIdentity contentIdentity, string message, params Object[] messageArgs); + + public void PopFile() + { + throw new NotImplementedException(); + } + + public void PushFile(string filename) + { + throw new NotImplementedException(); + } + + protected string GetCurrentFilename(ContentIdentity contentIdentity) + { + throw new NotImplementedException(); + } + } +} diff --git a/ANX.Framework.Content.Pipeline/ContentIdentity.cs b/ANX.Framework.Content.Pipeline/ContentIdentity.cs new file mode 100644 index 00000000..7a7ab8b6 --- /dev/null +++ b/ANX.Framework.Content.Pipeline/ContentIdentity.cs @@ -0,0 +1,59 @@ +#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 +{ + [Serializable] + public class ContentIdentity + { + public ContentIdentity() + { + + } + + public ContentIdentity(string sourceFilename) + { + SourceFilename = sourceFilename; + } + + public ContentIdentity(string sourceFilename, string sourceTool) + { + SourceFilename = sourceFilename; + SourceTool = sourceTool; + } + + public ContentIdentity(string sourceFilename, string sourceTool, string fragmentIdentifier) + { + SourceFilename = sourceFilename; + SourceTool = sourceTool; + FragmentIdentifier = fragmentIdentifier; + } + + public string FragmentIdentifier + { + get; + set; + } + + public string SourceFilename + { + get; + set; + } + + public string SourceTool + { + get; + set; + } + } +} diff --git a/ANX.Framework.Content.Pipeline/ContentImporter.cs b/ANX.Framework.Content.Pipeline/ContentImporter.cs new file mode 100644 index 00000000..2fc8cd1c --- /dev/null +++ b/ANX.Framework.Content.Pipeline/ContentImporter.cs @@ -0,0 +1,28 @@ +#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 +{ + public abstract class ContentImporter : IContentImporter + { + protected ContentImporter() + { + throw new NotImplementedException(); + } + + Object ANX.Framework.Content.Pipeline.IContentImporter.Import(string filename, ContentImporterContext context) + { + throw new NotImplementedException(); + } + + } +} diff --git a/ANX.Framework.Content.Pipeline/ContentImporterAttribute.cs b/ANX.Framework.Content.Pipeline/ContentImporterAttribute.cs new file mode 100644 index 00000000..e1002e7b --- /dev/null +++ b/ANX.Framework.Content.Pipeline/ContentImporterAttribute.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 +{ + public class ContentImporterAttribute : Attribute + { + public ContentImporterAttribute(string fileExtension) + { + FileExtensions = new string[] { fileExtension }; + } + + public ContentImporterAttribute(params string[] fileExtensions) + { + FileExtensions = fileExtensions; + } + + public bool CacheImportedData + { + get; + set; + } + + public string DefaultProcessor + { + get; + set; + } + + public virtual string DisplayName + { + get; + set; + } + + public IEnumerable FileExtensions + { + get; + private set; + } + } +} diff --git a/ANX.Framework.Content.Pipeline/ContentImporterContext.cs b/ANX.Framework.Content.Pipeline/ContentImporterContext.cs new file mode 100644 index 00000000..fde7da9b --- /dev/null +++ b/ANX.Framework.Content.Pipeline/ContentImporterContext.cs @@ -0,0 +1,27 @@ +#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 +{ + public abstract class ContentImporterContext + { + public ContentImporterContext() + { + throw new NotImplementedException(); + } + + public abstract string IntermediateDirectory { get; } + public abstract ContentBuildLogger Logger { get; } + public abstract string OutputDirectory { get; } + public abstract void AddDependency(string filename); + } +} diff --git a/ANX.Framework.Content.Pipeline/ContentItem.cs b/ANX.Framework.Content.Pipeline/ContentItem.cs new file mode 100644 index 00000000..334fb883 --- /dev/null +++ b/ANX.Framework.Content.Pipeline/ContentItem.cs @@ -0,0 +1,42 @@ +#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 +{ + public class ContentItem + { + public ContentItem() + { + throw new NotImplementedException(); + } + + public ContentIdentity Identity + { + get; + set; + } + + public string Name + { + get; + set; + } + + public OpaqueDataDictionary OpaqueData + { + get; + private set; + } + + + } +} diff --git a/ANX.Framework.Content.Pipeline/ContentProcessor.cs b/ANX.Framework.Content.Pipeline/ContentProcessor.cs new file mode 100644 index 00000000..10793129 --- /dev/null +++ b/ANX.Framework.Content.Pipeline/ContentProcessor.cs @@ -0,0 +1,39 @@ +#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 +{ + public abstract class ContentProcessor : IContentProcessor + { + protected ContentProcessor() + { + throw new NotImplementedException(); + } + + public abstract TOutput Process(TInput input, ContextProcessorContext context); + + Type IContentProcessor.InputType + { + get { throw new NotImplementedException(); } + } + + Type IContentProcessor.OutputType + { + get { throw new NotImplementedException(); } + } + + object IContentProcessor.Process(object input, ContextProcessorContext context) + { + throw new NotImplementedException(); + } + } +} diff --git a/ANX.Framework.Content.Pipeline/ContentProcessorAttribute.cs b/ANX.Framework.Content.Pipeline/ContentProcessorAttribute.cs new file mode 100644 index 00000000..a719b79e --- /dev/null +++ b/ANX.Framework.Content.Pipeline/ContentProcessorAttribute.cs @@ -0,0 +1,27 @@ +#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 +{ + public class ContentProcessorAttribute : Attribute + { + public ContentProcessorAttribute() + { + } + + public virtual string DisplayName + { + get; + set; + } + } +} diff --git a/ANX.Framework.Content.Pipeline/ContextProcessorContext.cs b/ANX.Framework.Content.Pipeline/ContextProcessorContext.cs new file mode 100644 index 00000000..0b589307 --- /dev/null +++ b/ANX.Framework.Content.Pipeline/ContextProcessorContext.cs @@ -0,0 +1,57 @@ +#region Using Statements +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using ANX.Framework.Graphics; + +#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 abstract class ContextProcessorContext + { + public ContextProcessorContext() + { + throw new NotImplementedException(); + } + + public abstract string BuildConfiguration { get; } + public abstract string IntermediateDirectory { get; } + public abstract ContentBuildLogger Logger { get; } + public abstract string OutputDirectory { get; } + public abstract string OutputFilename { get; } + public abstract OpaqueDataDictionary Parameters { get; } + public abstract TargetPlatform TargetPlatform { get; } + public abstract GraphicsProfile TargetProfile { get; } + + public abstract void AddDependency(string filename); + public abstract void AddOutputFile(string filename); + + public TOutput BuildAndLoadAsset(ExternalReference sourceAsset, string processorName) + { + throw new NotImplementedException(); + } + + public abstract TOutput BuildAndLoadAsset(ExternalReference sourceAsset, string processorName, OpaqueDataDictionary processorParameters, string importerName); + + public ExternalReference BuildAsset(ExternalReference sourceAsset, string processorName) + { + throw new NotImplementedException(); + } + + public abstract ExternalReference BuildAsset(ExternalReference sourceAsset, string processorName, OpaqueDataDictionary processorParameters, string importerName, string assetName); + + public TOutput Convert(TInput input, string processorName) + { + throw new NotImplementedException(); + } + + public abstract TOutput Convert(TInput input, string processorName, OpaqueDataDictionary processorParameters); + + } +} diff --git a/ANX.Framework.Content.Pipeline/ExternalReference.cs b/ANX.Framework.Content.Pipeline/ExternalReference.cs new file mode 100644 index 00000000..5b872219 --- /dev/null +++ b/ANX.Framework.Content.Pipeline/ExternalReference.cs @@ -0,0 +1,38 @@ +#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 +{ + public sealed class ExternalReference : ContentItem + { + public ExternalReference() + { + } + + public ExternalReference(string filename) + { + Filename = filename; + } + + public ExternalReference(string filename, ContentIdentity relativeToContent) + { + Filename = filename; + Identity = relativeToContent; + } + + public string Filename + { + get; + set; + } + } +} diff --git a/ANX.Framework.Content.Pipeline/IContentImporter.cs b/ANX.Framework.Content.Pipeline/IContentImporter.cs new file mode 100644 index 00000000..bf98339c --- /dev/null +++ b/ANX.Framework.Content.Pipeline/IContentImporter.cs @@ -0,0 +1,16 @@ +#region Using Statements +using System; + +#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 interface IContentImporter + { + Object Import(string filename, ContentImporterContext context); + } +} diff --git a/ANX.Framework.Content.Pipeline/IContentProcessor.cs b/ANX.Framework.Content.Pipeline/IContentProcessor.cs new file mode 100644 index 00000000..b0e88333 --- /dev/null +++ b/ANX.Framework.Content.Pipeline/IContentProcessor.cs @@ -0,0 +1,21 @@ +#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 +{ + public interface IContentProcessor + { + Type InputType { get; } + Type OutputType { get; } + Object Process(Object input, ContextProcessorContext context); + } +} diff --git a/ANX.Framework.Content.Pipeline/NamedValueDictionary.cs b/ANX.Framework.Content.Pipeline/NamedValueDictionary.cs new file mode 100644 index 00000000..22c98a12 --- /dev/null +++ b/ANX.Framework.Content.Pipeline/NamedValueDictionary.cs @@ -0,0 +1,145 @@ +#region Using Statements +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Collections; + +#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 NamedValueDictionary : IDictionary, ICollection>, IEnumerable>, IEnumerable + { + public NamedValueDictionary() + { + throw new NotImplementedException(); + } + + public int Count + { + get; + private set; + } + + public T this[string key] + { + get + { + throw new NotImplementedException(); + } + set + { + throw new NotImplementedException(); + } + } + + public ICollection Keys + { + get + { + throw new NotImplementedException(); + } + } + + public ICollection Values + { + get + { + throw new NotImplementedException(); + } + } + + protected internal virtual Type DefaultSerializerType + { + get + { + throw new NotImplementedException(); + } + } + + public void Add(string key, T value) + { + throw new NotImplementedException(); + } + + public void Clear() + { + throw new NotImplementedException(); + } + + public bool ContainsKey(string key) + { + throw new NotImplementedException(); + } + + public IEnumerator> GetEnumerator() + { + throw new NotImplementedException(); + } + + public bool Remove(string key) + { + throw new NotImplementedException(); + } + + public bool TryGetValue(string key, out T value) + { + throw new NotImplementedException(); + } + + protected virtual void AddItem(string key, T value) + { + throw new NotImplementedException(); + } + + protected virtual void ClearItems() + { + throw new NotImplementedException(); + } + + protected virtual bool RemoveItem(string key) + { + throw new NotImplementedException(); + } + + protected virtual void SetItem(string key, T value) + { + throw new NotImplementedException(); + } + + bool ICollection>.IsReadOnly + { + get { throw new NotImplementedException(); } + } + + void ICollection>.Add(KeyValuePair item) + { + throw new NotImplementedException(); + } + + bool ICollection>.Contains(KeyValuePair item) + { + throw new NotImplementedException(); + } + + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + bool ICollection>.Remove(KeyValuePair item) + { + throw new NotImplementedException(); + } + } +} diff --git a/ANX.Framework.Content.Pipeline/Serialization/Compiler/BuiltInTypeWriter.cs b/ANX.Framework.Content.Pipeline/Serialization/Compiler/BuiltInTypeWriter.cs index 66e39f4c..872cedab 100644 --- a/ANX.Framework.Content.Pipeline/Serialization/Compiler/BuiltInTypeWriter.cs +++ b/ANX.Framework.Content.Pipeline/Serialization/Compiler/BuiltInTypeWriter.cs @@ -1,4 +1,11 @@ -using System; +#region Using Statements +using System; + +#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.Serialization.Compiler {