public void WriteValue(Object Value, JsonWriter Writer, MudObject Owner) { if (Serializer != null) { Serializer.WriteValue(Value, Writer, Owner); } else { PersistAttribute._WriteValue(Value, Writer, Owner); } }
public static void _WriteValue(Object Value, JsonWriter Writer, MudObject Owner) { var name = Value.GetType().Name; PersistentValueSerializer serializer = null; if (PersistentValueSerializer.GlobalSerializers.TryGetValue(name, out serializer)) { Writer.WriteStartObject(); Writer.WritePropertyName("$type"); Writer.WriteValue(name); Writer.WritePropertyName("$value"); serializer.WriteValue(Value, Writer, Owner); Writer.WriteEndObject(); } else { Writer.WriteValue(Value); //Hope... } }