示例#1
0
 public void WriteValue(Object Value, JsonWriter Writer, MudObject Owner)
 {
     if (Serializer != null)
     {
         Serializer.WriteValue(Value, Writer, Owner);
     }
     else
     {
         PersistAttribute._WriteValue(Value, Writer, Owner);
     }
 }
示例#2
0
        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...
            }
        }