Beispiel #1
0
        public override void Add(string aKey, JSONNode aItem)
        {
            if (aItem == null)
                aItem = JSONNull.CreateOrGet();

            if (!string.IsNullOrEmpty(aKey))
            {
                if (m_Dict.ContainsKey(aKey))
                    m_Dict[aKey] = aItem;
                else
                    m_Dict.Add(aKey, aItem);
            }
            else
                m_Dict.Add(Guid.NewGuid().ToString(), aItem);
        }
Beispiel #2
0
 private static JSONNode ParseElement(string token, bool quoted)
 {
     if (quoted)
         return token;
     string tmp = token.ToLower();
     if (tmp == "false" || tmp == "true")
         return tmp == "true";
     if (tmp == "null")
         return JSONNull.CreateOrGet();
     double val;
     if (double.TryParse(token, NumberStyles.Float, CultureInfo.InvariantCulture, out val))
         return val;
     else
         return token;
 }
Beispiel #3
0
 public override JSONNode this[int aIndex]
 {
     get
     {
         if (aIndex < 0 || aIndex >= m_Dict.Count)
             return null;
         return m_Dict.ElementAt(aIndex).Value;
     }
     set
     {
         if (value == null)
             value = JSONNull.CreateOrGet();
         if (aIndex < 0 || aIndex >= m_Dict.Count)
             return;
         string key = m_Dict.ElementAt(aIndex).Key;
         m_Dict[key] = value;
     }
 }
Beispiel #4
0
 public override JSONNode this[int aIndex]
 {
     get
     {
         if (aIndex < 0 || aIndex >= m_List.Count)
             return new JSONLazyCreator(this);
         return m_List[aIndex];
     }
     set
     {
         if (value == null)
             value = JSONNull.CreateOrGet();
         if (aIndex < 0 || aIndex >= m_List.Count)
             m_List.Add(value);
         else
             m_List[aIndex] = value;
     }
 }
Beispiel #5
0
 public override JSONNode this[string aKey]
 {
     get
     {
         if (m_Dict.ContainsKey(aKey))
             return m_Dict[aKey];
         else
             return new JSONLazyCreator(this, aKey);
     }
     set
     {
         if (value == null)
             value = JSONNull.CreateOrGet();
         if (m_Dict.ContainsKey(aKey))
             m_Dict[aKey] = value;
         else
             m_Dict.Add(aKey, value);
     }
 }
Beispiel #6
0
 public override void Add(string aKey, JSONNode aItem)
 {
     if (aItem == null)
         aItem = JSONNull.CreateOrGet();
     m_List.Add(aItem);
 }