Made AnimationEditor compatible with Dictionary SpriteMaps

Added MonoGame Pipeline's IntermediateSerializer and needed classes from the pipeline and  MonoGame.Framework.Utilities to make AnimationEditor capable of reading Dictionaries
This commit is contained in:
quinnvoker
2018-11-24 16:43:44 -08:00
parent 82ad36e485
commit c585f312a5
52 changed files with 3576 additions and 64 deletions
@@ -0,0 +1,36 @@
// MonoGame - Copyright (C) The MonoGame Team
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
using System;
using System.Diagnostics;
namespace Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate
{
class EnumSerializer : ContentTypeSerializer
{
public EnumSerializer(Type targetType) :
base(targetType, targetType.Name)
{
}
protected internal override object Deserialize(IntermediateReader input, ContentSerializerAttribute format, object existingInstance)
{
var str = input.Xml.ReadString();
try
{
return Enum.Parse(TargetType, str, true);
}
catch (Exception ex)
{
throw input.NewInvalidContentException(ex, "Invalid enum value '{0}' for type '{1}'", str, TargetType.Name);
}
}
protected internal override void Serialize(IntermediateWriter output, object value, ContentSerializerAttribute format)
{
Debug.Assert(value.GetType() == TargetType, "Got invalid value type!");
output.Xml.WriteString(value.ToString());
}
}
}