// Token: 0x06001764 RID: 5988 RVA: 0x000720A0 File Offset: 0x000702A0 private PathFilter ParseQuotedField(char indexerCloseChar, bool scan) { List <string> list = null; while (this._currentIndex < this._expression.Length) { string text = this.ReadQuotedString(); this.EatWhitespace(); this.EnsureLength("Path ended with open indexer."); if (this._expression[this._currentIndex] == indexerCloseChar) { if (list == null) { return(JPath.CreatePathFilter(text, scan)); } list.Add(text); if (!scan) { return(new FieldMultipleFilter(list)); } return(new ScanMultipleFilter(list)); } else { if (this._expression[this._currentIndex] != ',') { throw new JsonException("Unexpected character while parsing path indexer: " + this._expression[this._currentIndex].ToString()); } this._currentIndex++; this.EatWhitespace(); if (list == null) { list = new List <string>(); } list.Add(text); } } throw new JsonException("Path ended with open indexer."); }
internal IEnumerable <JToken> Evaluate(JToken t, bool errorWhenNoMatch) { return(JPath.Evaluate(this.Filters, t, errorWhenNoMatch)); }
public override bool IsMatch(JToken t) { IEnumerable <JToken> pathResult = JPath.Evaluate(Path, 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) { 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); }
private bool ParsePath(List <PathFilter> filters, int currentPartStartIndex, bool query) { char chr; bool flag = false; bool flag1 = false; bool flag2 = false; bool flag3 = false; Label3: while (this._currentIndex < this._expression.Length) { if (flag3) { break; } chr = this._expression[this._currentIndex]; if (chr <= ')') { if (chr == ' ') { if (this._currentIndex >= this._expression.Length) { continue; } flag3 = true; continue; } else { if (chr == '(') { goto Label2; } if (chr == ')') { goto Label0; } goto Label1; } } else if (chr == '.') { if (this._currentIndex > currentPartStartIndex) { string str = this._expression.Substring(currentPartStartIndex, this._currentIndex - currentPartStartIndex); if (str == "*") { str = null; } filters.Add(JPath.CreatePathFilter(str, flag)); flag = false; } if (this._currentIndex + 1 < this._expression.Length && this._expression[this._currentIndex + 1] == '.') { flag = true; this._currentIndex++; } this._currentIndex++; currentPartStartIndex = this._currentIndex; flag1 = false; flag2 = true; continue; } else { if (chr == '[') { goto Label2; } if (chr == ']') { goto Label0; } else { goto Label1; } } Label2: if (this._currentIndex > currentPartStartIndex) { string str1 = this._expression.Substring(currentPartStartIndex, this._currentIndex - currentPartStartIndex); if (str1 == "*") { str1 = null; } filters.Add(JPath.CreatePathFilter(str1, flag)); flag = false; } filters.Add(this.ParseIndexer(chr, flag)); this._currentIndex++; currentPartStartIndex = this._currentIndex; flag1 = true; flag2 = false; } bool length = this._currentIndex == this._expression.Length; if (this._currentIndex > currentPartStartIndex) { string str2 = this._expression.Substring(currentPartStartIndex, this._currentIndex - currentPartStartIndex).TrimEnd(new char[0]); if (str2 == "*") { str2 = null; } filters.Add(JPath.CreatePathFilter(str2, flag)); } else if (flag2 && length | query) { throw new JsonException("Unexpected end while parsing path."); } return(length); Label0: flag3 = true; goto Label3; Label1: if (!query || chr != '=' && chr != '<' && chr != '!' && chr != '>' && chr != '|' && chr != '&') { if (flag1) { throw new JsonException(string.Concat("Unexpected character following indexer: ", chr.ToString())); } this._currentIndex++; goto Label3; } else { flag3 = true; goto Label3; } }
public override bool IsMatch(JToken t) { IEnumerable <JToken> enumerable = JPath.Evaluate(this.Path, t, false); foreach (JToken current in enumerable) { JValue jValue = current as JValue; switch (base.Operator) { case QueryOperator.Equals: if (jValue != null && jValue.Equals(this.Value)) { bool result = true; return(result); } break; case QueryOperator.NotEquals: if (jValue != null && !jValue.Equals(this.Value)) { bool result = true; return(result); } break; case QueryOperator.Exists: { bool result = true; return(result); } case QueryOperator.LessThan: if (jValue != null && jValue.CompareTo(this.Value) < 0) { bool result = true; return(result); } break; case QueryOperator.LessThanOrEquals: if (jValue != null && jValue.CompareTo(this.Value) <= 0) { bool result = true; return(result); } break; case QueryOperator.GreaterThan: if (jValue != null && jValue.CompareTo(this.Value) > 0) { bool result = true; return(result); } break; case QueryOperator.GreaterThanOrEquals: if (jValue != null && jValue.CompareTo(this.Value) >= 0) { bool result = true; return(result); } break; default: throw new ArgumentOutOfRangeException(); } } return(false); }
public override bool IsMatch(JToken t) { foreach (JToken jtoken in JPath.Evaluate(this.Path, t, false)) { if (jtoken is JValue jvalue) { switch (this.Operator) { case QueryOperator.Equals: if (this.EqualsWithStringCoercion(jvalue, this.Value)) { return(true); } continue; case QueryOperator.NotEquals: if (!this.EqualsWithStringCoercion(jvalue, this.Value)) { return(true); } continue; case QueryOperator.Exists: return(true); case QueryOperator.LessThan: if (jvalue.CompareTo(this.Value) < 0) { return(true); } continue; case QueryOperator.LessThanOrEquals: if (jvalue.CompareTo(this.Value) <= 0) { return(true); } continue; case QueryOperator.GreaterThan: if (jvalue.CompareTo(this.Value) > 0) { return(true); } continue; case QueryOperator.GreaterThanOrEquals: if (jvalue.CompareTo(this.Value) >= 0) { return(true); } continue; default: continue; } } else { switch (this.Operator) { case QueryOperator.NotEquals: case QueryOperator.Exists: return(true); default: continue; } } } return(false); }
public override bool IsMatch(JToken t) { IEnumerable <JToken> pathResult = JPath.Evaluate(Path, 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.NotEquals: if (Value.Type == JTokenType.Null) { return(true); } break; case QueryOperator.Exists: return(true); } } } return(false); }
// Token: 0x06001451 RID: 5201 RVA: 0x0006B0B0 File Offset: 0x000692B0 private bool ParsePath(List <PathFilter> filters, int currentPartStartIndex, bool query) { bool scan = false; bool flag = false; bool flag2 = false; bool flag3 = false; while (this._currentIndex < this._expression.Length && !flag3) { char c = this._expression[this._currentIndex]; if (c <= ')') { if (c != ' ') { if (c != '(') { if (c != ')') { goto IL_1AA; } goto IL_DF; } } else { if (this._currentIndex < this._expression.Length) { flag3 = true; continue; } continue; } } else { if (c == '.') { if (this._currentIndex > currentPartStartIndex) { string text = this._expression.Substring(currentPartStartIndex, this._currentIndex - currentPartStartIndex); if (text == "*") { text = null; } filters.Add(JPath.CreatePathFilter(text, scan)); scan = false; } if (this._currentIndex + 1 < this._expression.Length && this._expression[this._currentIndex + 1] == '.') { scan = true; this._currentIndex++; } this._currentIndex++; currentPartStartIndex = this._currentIndex; flag = false; flag2 = true; continue; } if (c != '[') { if (c != ']') { goto IL_1AA; } goto IL_DF; } } if (this._currentIndex > currentPartStartIndex) { string text2 = this._expression.Substring(currentPartStartIndex, this._currentIndex - currentPartStartIndex); if (text2 == "*") { text2 = null; } filters.Add(JPath.CreatePathFilter(text2, scan)); scan = false; } filters.Add(this.ParseIndexer(c, scan)); scan = false; this._currentIndex++; currentPartStartIndex = this._currentIndex; flag = true; flag2 = false; continue; IL_DF: flag3 = true; continue; IL_1AA: if (query && (c == '=' || c == '<' || c == '!' || c == '>' || c == '|' || c == '&')) { flag3 = true; } else { if (flag) { throw new JsonException("Unexpected character following indexer: " + c.ToString()); } this._currentIndex++; } } bool flag4 = this._currentIndex == this._expression.Length; if (this._currentIndex > currentPartStartIndex) { string text3 = this._expression.Substring(currentPartStartIndex, this._currentIndex - currentPartStartIndex).TrimEnd(new char[0]); if (text3 == "*") { text3 = null; } filters.Add(JPath.CreatePathFilter(text3, scan)); } else if (flag2 && (flag4 || query)) { throw new JsonException("Unexpected end while parsing path."); } return(flag4); }
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) { 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); }