/// <summary>
        /// Adds an new items to specified DDAttributesCollection from its Json representation.
        /// </summary>
        /// <param name="ac">The deserialized attributes collection.</param>
        /// <param name="s">Json stream reader</param>
        internal static void JsonDeserialize(this DDAttributesCollection ac, JsonReader reader)
        {
            string prevValueString = null;
            string prevName        = null;

            JsonToken prevTokenType = JsonToken.None;

            while (reader.Read())
            {
                if (reader.TokenType == JsonToken.EndArray)
                {
                    break;                                         // end list of attributes
                }
                if ((reader.TokenType == JsonToken.PropertyName) && (prevTokenType == JsonToken.StartObject) && (reader.Value != null))
                {
                    ac.Add(reader.Value.ToString(), DDValueSje.Deserialize(reader));
                }
                //  save current values
                prevTokenType = reader.TokenType;
                if (reader.TokenType == JsonToken.None)
                {
                    prevValueString = null;
                    prevName        = null;
                }
                else if (reader.TokenType == JsonToken.PropertyName)
                {
                    prevName = reader.Value.ToString();
                }
                else if (reader.TokenType == JsonToken.String)
                {
                    prevValueString = reader.Value.ToString();
                }
            }
        }
Пример #2
0
 /// <summary>
 ///  Generates an new DDValue from its Json representation.
 /// </summary>
 /// <param name="reader">Json stream reader</param>
 /// <returns>an new DDValue</returns>
 public void Deserialize(JsonReader reader)
 {
     this.v = DDValueSje.Deserialize(reader);
 }
Пример #3
0
 /// <summary>
 /// Generates an new item to specified DDValue from its Json representation.
 /// </summary>
 /// <param name="tr">Text reader stream that contains the Json document to deserialize.</param>
 public void Deserialize(TextReader tr)
 {
     this.v = DDValueSje.Deserialize(tr);
 }
Пример #4
0
 /// <summary>
 /// Adds an new items to specified DDValue from its Json representation.
 /// </summary>
 /// <param name="s">Stream that contains the Json document to deserialize.</param>
 public void Deserialize(Stream s)
 {
     this.v = DDValueSje.Deserialize(s);
 }
Пример #5
0
 /// <summary>
 /// Generates an new item to specified DDValue from its Json representation.
 /// </summary>
 /// <param name="s">String that contains the Json document to deserialize.</param>
 public void Deserialize(string s)
 {
     this.v = DDValueSje.Deserialize(s);
 }