Esempio n. 1
0
        public override bool IsMatch(JToken root, JToken t)
        {
            IEnumerable <JToken> pathResult = JPath.Evaluate(Path, root, t, false);

            foreach (JToken r in pathResult)
            {
                JValue v = r as JValue;
                if (v != null)
                {
                    switch (Operator)
                    {
                    case QueryOperator.Equals:
                        if (EqualsWithStringCoercion(v, Value))
                        {
                            return(true);
                        }
                        break;

                    case QueryOperator.NotEquals:
                        if (!EqualsWithStringCoercion(v, Value))
                        {
                            return(true);
                        }
                        break;

                    case QueryOperator.GreaterThan:
                        if (v.CompareTo(Value) > 0)
                        {
                            return(true);
                        }
                        break;

                    case QueryOperator.GreaterThanOrEquals:
                        if (v.CompareTo(Value) >= 0)
                        {
                            return(true);
                        }
                        break;

                    case QueryOperator.LessThan:
                        if (v.CompareTo(Value) < 0)
                        {
                            return(true);
                        }
                        break;

                    case QueryOperator.LessThanOrEquals:
                        if (v.CompareTo(Value) <= 0)
                        {
                            return(true);
                        }
                        break;

                    case QueryOperator.Exists:
                        return(true);
                    }
                }
                else
                {
                    switch (Operator)
                    {
                    case QueryOperator.Exists:
                    // you can only specify primative types in a comparison
                    // notequals will always be true
                    case QueryOperator.NotEquals:
                        return(true);
                    }
                }
            }

            return(false);
        }
        public override bool IsMatch(JToken t)
        {
            QueryOperator @operator;
            bool          flag;

            using (IEnumerator <JToken> enumerator = JPath.Evaluate(this.Path, t, false).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    JValue current = enumerator.Current as JValue;
                    if (current == null)
                    {
                        @operator = base.Operator;
                        if (@operator != QueryOperator.NotEquals && @operator != QueryOperator.Exists)
                        {
                            continue;
                        }
                        flag = true;
                        return(flag);
                    }
                    else
                    {
                        @operator = base.Operator;
                        switch (@operator)
                        {
                        case QueryOperator.Equals:
                        {
                            if (!this.EqualsWithStringCoercion(current, this.Value))
                            {
                                continue;
                            }
                            flag = true;
                            return(flag);
                        }

                        case QueryOperator.NotEquals:
                        {
                            if (this.EqualsWithStringCoercion(current, this.Value))
                            {
                                continue;
                            }
                            flag = true;
                            return(flag);
                        }

                        case QueryOperator.Exists:
                        {
                            flag = true;
                            return(flag);
                        }

                        case QueryOperator.LessThan:
                        {
                            if (current.CompareTo(this.Value) >= 0)
                            {
                                continue;
                            }
                            flag = true;
                            return(flag);
                        }

                        case QueryOperator.LessThanOrEquals:
                        {
                            if (current.CompareTo(this.Value) > 0)
                            {
                                continue;
                            }
                            flag = true;
                            return(flag);
                        }

                        case QueryOperator.GreaterThan:
                        {
                            if (current.CompareTo(this.Value) <= 0)
                            {
                                continue;
                            }
                            flag = true;
                            return(flag);
                        }

                        case QueryOperator.GreaterThanOrEquals:
                        {
                            if (current.CompareTo(this.Value) < 0)
                            {
                                continue;
                            }
                            flag = true;
                            return(flag);
                        }

                        default:
                        {
                            continue;
                        }
                        }
                    }
                }
                return(false);
            }
            return(flag);
        }
        public override bool IsMatch(JToken t)
        {
            IEnumerable <JToken> pathResult = JPath.Evaluate(Path, t, false);

            foreach (JToken r in pathResult)
            {
                JValue v = r as JValue;
                switch (Operator)
                {
                case QueryOperator.Equals:
                    if (v != null && v.Equals(Value))
                    {
                        return(true);
                    }
                    break;

                case QueryOperator.NotEquals:
                    if (v != null && !v.Equals(Value))
                    {
                        return(true);
                    }
                    break;

                case QueryOperator.GreaterThan:
                    if (v != null && v.CompareTo(Value) > 0)
                    {
                        return(true);
                    }
                    break;

                case QueryOperator.GreaterThanOrEquals:
                    if (v != null && v.CompareTo(Value) >= 0)
                    {
                        return(true);
                    }
                    break;

                case QueryOperator.LessThan:
                    if (v != null && v.CompareTo(Value) < 0)
                    {
                        return(true);
                    }
                    break;

                case QueryOperator.LessThanOrEquals:
                    if (v != null && v.CompareTo(Value) <= 0)
                    {
                        return(true);
                    }
                    break;

                case QueryOperator.Exists:
                    return(true);

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            return(false);
        }
Esempio n. 4
0
        public override bool IsMatch(JToken t)
        {
            foreach (JValue value2 in JPath.Evaluate(this.Path, t, false))
            {
                if (value2 != null)
                {
                    switch (base.Operator)
                    {
                    case QueryOperator.Equals:
                        if (!this.EqualsWithStringCoercion(value2, this.Value))
                        {
                            break;
                        }
                        return(true);

                    case QueryOperator.NotEquals:
                        if (this.EqualsWithStringCoercion(value2, this.Value))
                        {
                            break;
                        }
                        return(true);

                    case QueryOperator.Exists:
                        return(true);

                    case QueryOperator.LessThan:
                        if (value2.CompareTo(this.Value) >= 0)
                        {
                            break;
                        }
                        return(true);

                    case QueryOperator.LessThanOrEquals:
                        if (value2.CompareTo(this.Value) > 0)
                        {
                            break;
                        }
                        return(true);

                    case QueryOperator.GreaterThan:
                        if (value2.CompareTo(this.Value) <= 0)
                        {
                            break;
                        }
                        return(true);

                    case QueryOperator.GreaterThanOrEquals:
                        if (value2.CompareTo(this.Value) < 0)
                        {
                            break;
                        }
                        return(true);
                    }
                }
                else
                {
                    switch (base.Operator)
                    {
                    case QueryOperator.NotEquals:
                    case QueryOperator.Exists:
                        return(true);
                    }
                }
            }
            return(false);
        }
Esempio n. 5
0
 // Token: 0x06001766 RID: 5990 RVA: 0x0001706A File Offset: 0x0001526A
 internal IEnumerable <JToken> Evaluate(JToken root, JToken t, bool errorWhenNoMatch)
 {
     return(JPath.Evaluate(this.Filters, root, t, errorWhenNoMatch));
 }