/// <summary> /// This method validates the particular piece of data against the script. /// </summary> /// <param name="matchCollection">The match collection.</param> /// <param name="data">The data to match.</param> /// <param name="method">The method to match.</param> /// <param name="variables">The variable collection.</param> /// <param name="success">An out paramterer denoting a successful match.</param> /// <param name="map">The map setting for the Uri.</param> /// <returns>Returns true if a match was made successfully, or no data was available to match.</returns> protected virtual bool ResolveMapping(Dictionary<int, Mapping> matchCollection, string data, string method, IDictionary<string, string> variables, out bool success, MappingSettings map) { success = false; if (matchCollection == null || matchCollection.Count == 0) return true; foreach (int mapID in matchCollection.Keys) { Mapping mapCheck = matchCollection[mapID]; Match tempMatch = null; Regex tempRegex = null; if (!mapCheck.RXMatch(data, out tempMatch, out tempRegex)) continue; if (mapCheck.MappingVerb != null && mapCheck.MappingVerb != "*" && mapCheck.MappingVerb != method && MethodCheckMultiple(mapCheck.MappingVerb, method)) continue; map.Set(mapCheck); //If this is not a redirect we should verify the variables. if (mapCheck.Redirect == null) success = VerifyVariables(variables, tempMatch, tempRegex); if (mapCheck.OutputColl.Count > 0) success = true; return true; } return false; }