Beispiel #1
0
 public JObject(object content)
 {
     Class6.yDnXvgqzyB5jw();
     this._properties = new JPropertyKeyedCollection();
     base();
     this.Add(content);
 }
Beispiel #2
0
        public bool Compare(JPropertyKeyedCollection other)
        {
            if (this == other)
            {
                return(true);
            }
            Dictionary <string, JToken> dictionary1 = this._dictionary;
            Dictionary <string, JToken> dictionary2 = other._dictionary;

            if (dictionary1 == null && dictionary2 == null)
            {
                return(true);
            }
            if (dictionary1 == null)
            {
                return(dictionary2.Count == 0);
            }
            if (dictionary2 == null)
            {
                return(dictionary1.Count == 0);
            }
            if (dictionary1.Count != dictionary2.Count)
            {
                return(false);
            }
            foreach (KeyValuePair <string, JToken> keyValuePair in dictionary1)
            {
                JToken jtoken;
                if (!dictionary2.TryGetValue(keyValuePair.Key, out jtoken) || !((JProperty)keyValuePair.Value).Value.DeepEquals(((JProperty)jtoken).Value))
                {
                    return(false);
                }
            }
            return(true);
        }
        public bool Compare(JPropertyKeyedCollection other)
        {
            if (this == other)
            {
                return(true);
            }

            // dictionaries in JavaScript aren't ordered
            // ignore order when comparing properties
            Dictionary <string, JToken> d1 = _dictionary;
            Dictionary <string, JToken> d2 = other._dictionary;

            if (d1 == null && d2 == null)
            {
                return(true);
            }

            if (d1 == null)
            {
                return(d2.Count == 0);
            }

            if (d2 == null)
            {
                return(d1.Count == 0);
            }

            if (d1.Count != d2.Count)
            {
                return(false);
            }

            foreach (KeyValuePair <string, JToken> keyAndProperty in d1)
            {
                JToken secondValue;
                if (!d2.TryGetValue(keyAndProperty.Key, out secondValue))
                {
                    return(false);
                }

                JProperty p1 = (JProperty)keyAndProperty.Value;
                JProperty p2 = (JProperty)secondValue;

                if (p1.Value == null)
                {
                    return(p2.Value == null);
                }

                if (!p1.Value.DeepEquals(p2.Value))
                {
                    return(false);
                }
            }

            return(true);
        }
Beispiel #4
0
        public bool Compare(JPropertyKeyedCollection other)
        {
            if (this == other)
            {
                return(true);
            }
            Dictionary <string, JToken> dictionary  = this._dictionary;
            Dictionary <string, JToken> dictionary2 = other._dictionary;

            if (dictionary == null && dictionary2 == null)
            {
                return(true);
            }
            if (dictionary == null)
            {
                return(dictionary2.Count == 0);
            }
            if (dictionary2 == null)
            {
                return(dictionary.Count == 0);
            }
            if (dictionary.Count != dictionary2.Count)
            {
                return(false);
            }
            foreach (KeyValuePair <string, JToken> current in dictionary)
            {
                JToken jToken;
                if (!dictionary2.TryGetValue(current.Key, out jToken))
                {
                    bool result = false;
                    return(result);
                }
                JProperty jProperty  = (JProperty)current.Value;
                JProperty jProperty2 = (JProperty)jToken;
                if (!jProperty.Value.DeepEquals(jProperty2.Value))
                {
                    bool result = false;
                    return(result);
                }
            }
            return(true);
        }
Beispiel #5
0
 public bool Compare(JPropertyKeyedCollection other)
 {
     if (this != other)
     {
         Dictionary <string, JToken> dictionary  = this._dictionary;
         Dictionary <string, JToken> dictionary2 = other._dictionary;
         if ((dictionary == null) && (dictionary2 == null))
         {
             return(true);
         }
         if (dictionary == null)
         {
             return(dictionary2.Count == 0);
         }
         if (dictionary2 == null)
         {
             return(dictionary.Count == 0);
         }
         if (dictionary.Count != dictionary2.Count)
         {
             return(false);
         }
         foreach (KeyValuePair <string, JToken> pair in dictionary)
         {
             if (!dictionary2.TryGetValue(pair.Key, out JToken token))
             {
                 return(false);
             }
             JProperty property  = (JProperty)pair.Value;
             JProperty property2 = (JProperty)token;
             if (property.Value == null)
             {
                 return(property2.Value == null);
             }
             if (!property.Value.DeepEquals(property2.Value))
             {
                 return(false);
             }
         }
     }
     return(true);
 }
Beispiel #6
0
 public JObject(JObject other)
 {
     Class6.yDnXvgqzyB5jw();
     this._properties = new JPropertyKeyedCollection();
     base(other);
 }
Beispiel #7
0
 public JObject(object content)
 {
     this._properties = new JPropertyKeyedCollection();
     this.Add(content);
 }
Beispiel #8
0
 public JObject(JObject other) : base(other)
 {
     this._properties = new JPropertyKeyedCollection();
 }
Beispiel #9
0
 public JObject()
 {
     this._properties = new JPropertyKeyedCollection();
 }
        public bool Compare(JPropertyKeyedCollection other)
        {
            JToken jTokens;
            bool   value;

            if (this == other)
            {
                return(true);
            }
            Dictionary <string, JToken> strs  = this._dictionary;
            Dictionary <string, JToken> strs1 = other._dictionary;

            if (strs == null && strs1 == null)
            {
                return(true);
            }
            if (strs == null)
            {
                return(strs1.Count == 0);
            }
            if (strs1 == null)
            {
                return(strs.Count == 0);
            }
            if (strs.Count != strs1.Count)
            {
                return(false);
            }
            Dictionary <string, JToken> .Enumerator enumerator = strs.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <string, JToken> current = enumerator.Current;
                    if (strs1.TryGetValue(current.Key, out jTokens))
                    {
                        JProperty jProperty  = (JProperty)current.Value;
                        JProperty jProperty1 = (JProperty)jTokens;
                        if (jProperty.Value != null)
                        {
                            if (jProperty.Value.DeepEquals(jProperty1.Value))
                            {
                                continue;
                            }
                            value = false;
                            return(value);
                        }
                        else
                        {
                            value = jProperty1.Value == null;
                            return(value);
                        }
                    }
                    else
                    {
                        value = false;
                        return(value);
                    }
                }
                return(true);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
            return(value);
        }