- Fixed an issue with content compiling: The readers for generic types were not registered in the XNB file and therefor couldn't be loaded.

- Fixed an issue with CharWriter: It was a ByteWriter (wrong name)...
This commit is contained in:
Glatzemann 2012-11-01 09:08:12 +00:00 committed by Konstantin Koch
parent 33604e198d
commit 0d3593c223
4 changed files with 34 additions and 14 deletions

View File

@ -30,12 +30,20 @@ namespace ANX.Framework.Content.Pipeline.Serialization.Compiler
}
public ContentTypeWriter GetTypeWriter(Type type)
{
IEnumerable<Type> dependencies;
return GetTypeWriter(type, out dependencies);
}
public ContentTypeWriter GetTypeWriter(Type type, out IEnumerable<Type> dependencies)
{
if (type == null)
{
throw new ArgumentNullException("type");
}
dependencies = new List<Type>();
ContentTypeWriter contentTypeWriter;
if (!this.writerInstances.TryGetValue(type, out contentTypeWriter))
{
@ -47,6 +55,14 @@ namespace ANX.Framework.Content.Pipeline.Serialization.Compiler
{
Type genericType = handler.MakeGenericType(type.GetGenericArguments());
contentTypeWriter = ((object)Activator.CreateInstance(genericType)) as ContentTypeWriter;
foreach (Type dependentType in type.GetGenericArguments())
{
if (!((List<Type>)dependencies).Contains(dependentType))
{
((List<Type>)dependencies).Add(dependentType);
}
}
}
}
else

View File

@ -235,6 +235,12 @@ namespace ANX.Framework.Content.Pipeline.Serialization.Compiler
writer.Write(this, value);
}
private ContentTypeWriter GetTypeWriter(Type type)
{
int typeIndex;
return GetTypeWriter(type, out typeIndex);
}
private ContentTypeWriter GetTypeWriter(Type type, out int typeIndex)
{
if (this.typeTable.TryGetValue(type, out typeIndex))
@ -242,21 +248,19 @@ namespace ANX.Framework.Content.Pipeline.Serialization.Compiler
return this.typeWriters[typeIndex];
}
IEnumerable<Type> enumerable = null;
ContentTypeWriter typeWriter = this.compiler.GetTypeWriter(type); //TODO:, out enumerable);
IEnumerable<Type> dependencies = null;
ContentTypeWriter typeWriter = this.compiler.GetTypeWriter(type, out dependencies);
typeIndex = this.typeWriters.Count;
this.typeWriters.Add(typeWriter);
this.typeTable.Add(type, typeIndex);
//TODO: what is this for?
//foreach (Type current in enumerable)
//{
// if (!(current == typeof(object)))
// {
// int num;
// this.GetTypeWriter(current, out num);
// }
//}
foreach (Type dependentType in dependencies)
{
if (!(dependentType == typeof(object)))
{
this.GetTypeWriter(dependentType);
}
}
return typeWriter;
}

View File

@ -7,7 +7,7 @@
namespace ANX.Framework.Content.Pipeline.Serialization.Compiler.SystemTypeWriters
{
[ContentTypeWriter]
internal class ByteWriter : BuiltinTypeWriter<char>
internal class CharWriter : BuiltinTypeWriter<Char>
{
protected internal override void Write(ContentWriter output, char value)
{

View File

@ -31,8 +31,8 @@ using System.Runtime.InteropServices;
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
[assembly: AssemblyVersion("0.4.39.*")]
[assembly: AssemblyFileVersion("0.4.39.0")]
[assembly: AssemblyVersion("0.5.0.*")]
[assembly: AssemblyFileVersion("0.5.0.0")]
[assembly: InternalsVisibleTo("ANX.RenderSystem.Windows.DX10")]
[assembly: InternalsVisibleTo("ANX.RenderSystem.Windows.DX11")]