public override bool ContainsKeyValuePair(string key, string value, SpotterContext context) { if (context.HasFlag(SpotterContext.AllPair)) { if (this._headerFields.ContainsKey(key) && this._headerFields[key].Contains(value)) { return(true); } if (this._requestUriParameters != null && this._requestUriParameters.ContainsKey(key) && this._requestUriParameters[key].Contains(value)) { return(true); } } if (context.HasFlag(SpotterContext.ContentPair) || context.HasFlag(SpotterContext.AllPair)) { if (this._contentFields == null) { return(false); } if (this._contentFields.ContainsKey(key) && this._contentFields[key].Contains(value)) { return(true); } } return(false); }
public override bool Contains(string str, SpotterContext context) { if (context.HasFlag(SpotterContext.AllKey)) { if (this._requestUriParameters.ContainsKey(str)) { return(true); } if (this._headerFields.ContainsKey(str)) { return(true); } } if (context.HasFlag(SpotterContext.AllValue)) { if (this._headerFields.Keys.Any(key => this._headerFields[key].Contains(str))) { return(true); } if (this._requestUriParameters != null && this._requestUriParameters.Keys.Any(key => this._requestUriParameters[key].Contains(str))) { return(true); } } return(this.Items.Any(item => this.ItemContains(item, str, context))); }
public override bool ContainsKeyValuePair(string key, string value, SpotterContext context) { this.Reset(); while (this.HasNextPart()) { var spotter = this.GetNextPart(); if (spotter.ContainsKeyValuePair(key, value, context)) { this.UnloadPart(spotter); return(true); } this.UnloadPart(spotter); } //for (var i = 0; i < this._boundariesIndices.Count-1; i += 2) //{ // var part = this._content.Substring(this._boundariesIndices[i], this._boundariesIndices[i + 1] - this._boundariesIndices[i]); // var contentType = this.GetStringPart("Content-Type: ", "\r\n", part); // var spotter = SpotterFactory.GetSpotter(contentType); // part = part.Substring(part.IndexOf("\r\n\r\n", StringComparison.Ordinal) + 4); // this._clone.HTTPContent.Content = Encoding.ASCII.GetBytes(part); // spotter.Init(this._clone); // if (spotter.ContainsKeyValuePair(key, value, context)) return true; //} return(false); }
public override bool Contains(string str, SpotterContext context) { if (context.HasFlag(SpotterContext.ContentKey) || context.HasFlag(SpotterContext.ContentValue)) { return(this.ContentContains(str, context)); } if (context.HasFlag(SpotterContext.AllKey)) { if (this._requestUriParameters?.ContainsKey(str) ?? false) { return(true); } if (this._headerFields.ContainsKey(str)) { return(true); } if (this._root == null) { return(false); } if (this._root.XPathSelectElement("//" + str) != null) { return(true); } } if (context.HasFlag(SpotterContext.AllValue)) { if (this._headerFields.Keys.Any(key => this._headerFields[key].Contains(str))) { return(true); } if (this._requestUriParameters != null && this._requestUriParameters.Keys.Any(key => this._requestUriParameters[key].Contains(str))) { return(true); } if (this._root == null) { return(false); } if (this._root.XPathSelectElements("//*").Any(element => element.Value.Equals(str))) { return(true); } } return(this._requestUri?.Contains(str) ?? false); }
public override bool Contains(string str, SpotterContext context) { if (context.HasFlag(SpotterContext.ContentKey) || context.HasFlag(SpotterContext.ContentValue)) { return(this.ContentContains(str, context)); } if (context.HasFlag(SpotterContext.AllKey)) { if (this._requestUriParameters.ContainsKey(str)) { return(true); } if (this._headerFields.ContainsKey(str)) { return(true); } if (this._contentFields == null) { return(false); } if (this._contentFields.ContainsKey(str)) { return(true); } } if (context.HasFlag(SpotterContext.AllValue)) { if (this._headerFields.Keys.Any(key => this._headerFields[key].Contains(str))) { return(true); } if (this._requestUriParameters != null && this._requestUriParameters.Keys.Any(key => this._requestUriParameters[key].Contains(str))) { return(true); } if (this._contentFields == null) { return(false); } if (this._contentFields.Keys.Any(key => this._contentFields[key].Contains(str))) { return(true); } } return(this._requestUri.Contains(str)); }
public override bool ContainsKeyValuePair(string key, string value, SpotterContext context) { if (context.HasFlag(SpotterContext.AllPair)) { if (this._headerFields.ContainsKey(key) && this._headerFields[key].Contains(value)) { return(true); } if (this._requestUriParameters != null && this._requestUriParameters.ContainsKey(key) && (this._requestUriParameters[key].Contains(value) || value.Equals("*"))) { return(true); } } return(this.Items.Any(item => this.ItemContainsPair(item, key, value, context))); }
private bool ItemContains(FRPCparser.IFRPCItem item, string str, SpotterContext context) { switch (item.Type) { case FRPCparser.ItemType.MethodCall: var methodCall = item as FRPCparser.FRPCMethodCall; if (methodCall == null) { return(false); } return(((context.HasFlag(SpotterContext.AllKey) || context.HasFlag(SpotterContext.ContentKey)) && methodCall.Name.Contains(str)) || methodCall.Parameters.Any(param => this.ItemContains(param, str, context))); case FRPCparser.ItemType.MethodReponse: var methodResoponse = item as FRPCparser.FRPCMethodRespone; return(methodResoponse != null && methodResoponse.Data.Any(data => this.ItemContains(data, str, context))); case FRPCparser.ItemType.Array: var array = item as FRPCparser.FRPCArray; return(array != null && array.Items.Any(x => this.ItemContains(x, str, context))); case FRPCparser.ItemType.Struct: var fStruct = item as FRPCparser.FRPCStruct; if ((context.HasFlag(SpotterContext.AllKey) || context.HasFlag(SpotterContext.ContentKey)) && fStruct != null && fStruct.Items.Any(x => x.Key.Equals(str))) { return(true); } return(fStruct != null && fStruct.Items.Any(x => this.ItemContains(x.Value, str, context))); case FRPCparser.ItemType.String: var stri = item as FRPCparser.FRPCString; return(stri != null && stri.Value.Equals(str)); } return(false); }
public override bool ContainsKeyValuePair(string key, string value, SpotterContext context) { if (context.HasFlag(SpotterContext.AllPair)) { if (this._headerFields.ContainsKey(key) && this._headerFields[key].Contains(value)) { return(true); } if (this._requestUriParameters != null && this._requestUriParameters.ContainsKey(key) && this._requestUriParameters[key].Contains(value)) { return(true); } } if (context.HasFlag(SpotterContext.ContentPair) || context.HasFlag(SpotterContext.AllPair)) { return(this._root != null && this._root.XPathSelectElements("//" + key).Any(element => element.Value.Equals(value))); } return(false); }
private bool ContentContains(string str, SpotterContext context) { if (this._contentFields == null) { return(false); } if (context.HasFlag(SpotterContext.ContentKey)) { if (this._contentFields.ContainsKey(str)) { return(true); } } if (context.HasFlag(SpotterContext.ContentValue)) { return(this._contentFields.Keys.Any(key => this._contentFields[key].Contains(str))); } return(false); }
private bool ContentContains(string str, SpotterContext context) { if (this._root == null) { return(false); } if (context.HasFlag(SpotterContext.ContentKey) || context.HasFlag(SpotterContext.AllKey)) { if (this._root.XPathSelectElement("//" + str) != null) { return(true); } } if (context.HasFlag(SpotterContext.ContentValue) || context.HasFlag(SpotterContext.AllValue)) { return(this._root.XPathSelectElements("//*").Any(element => element.Value.Equals(str))); } return(false); }
public override bool ContainsKeyValuePair(string key, string value, SpotterContext context) { return(false); }
private bool ItemContainsPair(FRPCparser.IFRPCItem item, string key, string value, SpotterContext context) { switch (item.Type) { case FRPCparser.ItemType.MethodCall: var methodCall = item as FRPCparser.FRPCMethodCall; if (methodCall == null) { return(false); } return((methodCall.Name.Contains(key) && methodCall.Parameters.Any(param => this.ItemContains(param, value, context))) || methodCall.Parameters.Any(param => this.ItemContainsPair(param, key, value, context))); case FRPCparser.ItemType.Array: var array = item as FRPCparser.FRPCArray; return(array != null && array.Items.Any(x => this.ItemContainsPair(x, key, value, context))); case FRPCparser.ItemType.Struct: var fStruct = item as FRPCparser.FRPCStruct; if (fStruct != null) { return(fStruct.Items.Any(x => x.Key.Equals(key) && this.ItemContains(x.Value, value, context)) || fStruct.Items.Any(x => this.ItemContainsPair(x.Value, key, value, context))); } break; } return(false); }
public override bool ContainsOneOf(string[] strArr, SpotterContext context) { return(strArr.Any(key => this.Contains(key, context))); }
public override bool Contains(string[] strArr, SpotterContext context) { var cnt = strArr.Count(key => this.Contains(key, context)); return(cnt == strArr.Length); }
/// <summary> /// Checks if there is specified string in spottable content, specified by SpotterContext flag. /// </summary> /// <param name="str">String that should be look for.</param> /// <param name="context">Context that should be look in.</param> /// <returns>true if string was found, false otherwise</returns> public abstract bool Contains(string str, SpotterContext context);
/// <summary> /// Checks if there is at least one of the specified strings. /// </summary> /// <param name="strArr">strings that should be look for</param> /// <param name="context">context htat should be look in</param> /// <returns>true if at least one of the string was found, false otherwise</returns> public abstract bool ContainsOneOf(string[] strArr, SpotterContext context);
/// <summary> /// Checks if content contains specified key/value pair. /// If content can't be separated on keys and values and no other part of HTTP message is under spoting context, /// then this method should return false. /// </summary> /// <param name="key">key string that should be look for</param> /// <param name="value">value string that should be look for as pair of specified key</param> /// <param name="context">context that should be look in</param> /// <returns>true if specified key/value pair was found</returns> public abstract bool ContainsKeyValuePair(string key, string value, SpotterContext context);
public override bool Contains(string[] strArr, SpotterContext context) { var i = strArr.Count(str => this.Contains(str, context)); return(i == strArr.Length); }
public override bool Contains(string str, SpotterContext context) { return(this._content?.Contains(str) ?? false); }