Пример #1
0
        public bool Equals(MTJSONObject jsonObj)
        {
            if ((object)jsonObj == null)
            {
                return(this._o == null);
            }

            if (this._o == null && jsonObj._o == null)
            {
                return(true);
            }

            return(this._o.Equals(jsonObj._o));
        }
Пример #2
0
        public override bool Equals(Object obj)
        {
            if (obj == null)
            {
                return(this._o == null);
            }

            MTJSONObject jsonObj = obj as MTJSONObject;

            if ((Object)jsonObj == null)
            {
                return(false);
            }

            if (this._o == null && jsonObj._o == null)
            {
                return(true);
            }

            return(this._o.Equals(jsonObj._o));
        }
Пример #3
0
            private MTJSONObject ParseArray()
            {
                List <MTJSONObject> array = new List <MTJSONObject> ();

                // ditch opening bracket
                this.json.Read();

                // [
                var parsing = true;

                while (parsing)
                {
                    TOKEN nextToken = this.NextToken;

                    switch (nextToken)
                    {
                    case TOKEN.NONE:
                        return(null);

                    case TOKEN.COMMENTS:
                        EatComments();
                        continue;

                    case TOKEN.COMMA:
                        continue;

                    case TOKEN.SQUARED_CLOSE:
                        parsing = false;
                        break;

                    default:
                        MTJSONObject value = this.ParseByToken(nextToken);

                        array.Add(value);
                        break;
                    }
                }

                return(new MTJSONObject(array));
            }
Пример #4
0
        public void Set(int index, object item)
        {
            List <MTJSONObject> asList = list;

            if (index >= 0)
            {
                while (index >= asList.Count)
                {
                    asList.Add(null);
                }
                MTJSONObject asMTJSONObject = null;
                if (item != null)
                {
                    asMTJSONObject = item as MTJSONObject;
                    if (asMTJSONObject == null)
                    {
                        asMTJSONObject = new MTJSONObject(item);
                    }
                }
                asList [index] = asMTJSONObject;
            }
        }
Пример #5
0
        public void Add(string key, object value)
        {
            MTJSONObject asMTJSONObject = null;

            if (value != null)
            {
                asMTJSONObject = value as MTJSONObject;
                if (asMTJSONObject == null)
                {
                    asMTJSONObject = new MTJSONObject(value);
                }
            }
            Dictionary <string, MTJSONObject> asDict = dict;

            if (asDict.ContainsKey(key))
            {
                asDict [key] = asMTJSONObject;
            }
            else
            {
                asDict.Add(key, asMTJSONObject);
            }
        }