Ejemplo n.º 1
0
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            writer.WriteStartObject();

            var propertyDictionary = (IDictionary <string, SerializedPropertyInfo>)value;

            foreach (KeyValuePair <string, SerializedPropertyInfo> pair in propertyDictionary)
            {
                writer.WritePropertyName(pair.Key);
                SerializedPropertyInfoConverter.Write(writer, pair.Value);
            }

            writer.WriteEndObject();
        }
Ejemplo n.º 2
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            IDictionary <string, SerializedPropertyInfo> dictionary = (existingValue as IDictionary <string, SerializedPropertyInfo> ?? new Dictionary <string, SerializedPropertyInfo>());

            reader.Read();

            while (reader.TokenType == JsonToken.PropertyName)
            {
                string name = (string)reader.Value;
                reader.Read();

                SerializedPropertyInfo value = SerializedPropertyInfoConverter.Read(reader);
                reader.Read();

                dictionary[name] = value;
            }

            return(dictionary);
        }