Пример #1
0
        public override void Add(string aKey, JSONNode aItem)
        {
            if (aItem == null)
            {
                aItem = JSONNull.CreateOrGet();
            }

            if (aKey != null)
            {
                if (m_Dict.ContainsKey(aKey))
                {
                    m_Dict[aKey] = aItem;
                }
                else
                {
                    m_Dict.Add(aKey, aItem);
                }
            }
            else
            {
                m_Dict.Add(Guid.NewGuid().ToString(), aItem);
            }
        }
Пример #2
0
        public override void Add(string aKey, JSONNode aItem)
        {
            if (aItem == null)
            {
                aItem = new JSONNull();
            }

            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);
            }
        }
Пример #3
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;
         }
     }
 }
Пример #4
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());
            }

            //! veg Patched start.
            Boolean isLong = (longAsString && long.TryParse(token, out long lval));

            if (double.TryParse(token, NumberStyles.Float, CultureInfo.InvariantCulture, out double rval))
            {
                if (isLong && !rval.ToString("F0").Equals(token))
                {
                    return(token);
                }
                else
                {
                    return(rval);
                }
            }
            else
            {
                return(token);
            }
            //! veg Patched end.
        }
 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;
     }
 }
Пример #6
0
 // Token: 0x1700005B RID: 91
 public override JSONNode this[int aIndex]
 {
     get
     {
         if (aIndex < 0 || aIndex >= this.m_Dict.Count)
         {
             return(null);
         }
         return(this.m_Dict.ElementAt(aIndex).Value);
     }
     set
     {
         if (value == null)
         {
             value = new JSONNull();
         }
         if (aIndex < 0 || aIndex >= this.m_Dict.Count)
         {
             return;
         }
         string key = this.m_Dict.ElementAt(aIndex).Key;
         this.m_Dict[key] = value;
     }
 }
Пример #7
0
 // Token: 0x1700005A RID: 90
 public override JSONNode this[string aKey]
 {
     get
     {
         if (this.m_Dict.ContainsKey(aKey))
         {
             return(this.m_Dict[aKey]);
         }
         return(new JSONLazyCreator(this, aKey));
     }
     set
     {
         if (value == null)
         {
             value = new JSONNull();
         }
         if (this.m_Dict.ContainsKey(aKey))
         {
             this.m_Dict[aKey] = value;
             return;
         }
         this.m_Dict.Add(aKey, value);
     }
 }
Пример #8
0
 // Token: 0x17000050 RID: 80
 public override JSONNode this[int aIndex]
 {
     get
     {
         if (aIndex < 0 || aIndex >= this.m_List.Count)
         {
             return(new JSONLazyCreator(this));
         }
         return(this.m_List[aIndex]);
     }
     set
     {
         if (value == null)
         {
             value = new JSONNull();
         }
         if (aIndex < 0 || aIndex >= this.m_List.Count)
         {
             this.m_List.Add(value);
             return;
         }
         this.m_List[aIndex] = value;
     }
 }
Пример #9
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);
                }
            }
        }
Пример #10
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);
            }
            return(token);
        }
Пример #11
0
 public override void Add(string aKey, JSONNode aItem)
 {
     _dict[aKey ?? string.Empty] = aItem ?? JSONNull.CreateOrGet();
 }
Пример #12
0
 public override void Add(string aKey, JSONNode aItem)
 {
     if (aItem == null)
         aItem = new JSONNull();
     m_List.Add(aItem);
 }