private void ParseTargetedFile(AdvancedRecomendation captureEvent, string readText, ComplexCaptureMatchObject complexCaptureMatchObject, string fileName) { captureEvent = GetCapturePointListType(captureEvent); XDocument xdoc = XDocument.Parse(readText); List<string> foundEvents = new List<string>(); if (captureEvent.capturePointListType == CapturePointListType.SimpleList) { List<XNode> foundNodes = ParseUsingSimpleList(captureEvent, xdoc, foundEvents); totalFoundNodes = totalFoundNodes + foundNodes.Count; if (foundNodes.Count > 0) { FileAndNumberOfMatches fileAndNumberOfMatches = new FileAndNumberOfMatches(); fileAndNumberOfMatches.fileName = fileName; fileAndNumberOfMatches.matchedNodes = foundNodes; complexCaptureMatchObject.fileNamesHit.Add(fileAndNumberOfMatches); } } else { List<XNode> foundNodes = ParseUsingAdvancedList(captureEvent, xdoc); totalFoundNodes = totalFoundNodes + foundNodes.Count; if (foundNodes.Count > 0) { FileAndNumberOfMatches fileAndNumberOfMatches = new FileAndNumberOfMatches(); fileAndNumberOfMatches.fileName = fileName; fileAndNumberOfMatches.matchedNodes = foundNodes; complexCaptureMatchObject.fileNamesHit.Add(fileAndNumberOfMatches); } } }
private string ParseTargetedFile(AdvancedRecomendation captureEvent, string readText) { captureEvent = GetCapturePointListType(captureEvent); XDocument xdoc = XDocument.Parse(readText); List<string> foundEvents = new List<string>(); List<XNode> foundNodes = new List<XNode>(); if (captureEvent.capturePointListType == CapturePointListType.SimpleList) { foundNodes = ParseUsingSimpleList(captureEvent, xdoc, foundEvents); if (foundNodes.Count > 0) { FileAndNumberOfMatches fileAndNumberOfMatches = new FileAndNumberOfMatches(); fileAndNumberOfMatches.matchedNodes = foundNodes; } } else { foundNodes = ParseUsingAdvancedList(captureEvent, xdoc); if (foundNodes.Count > 0) { FileAndNumberOfMatches fileAndNumberOfMatches = new FileAndNumberOfMatches(); fileAndNumberOfMatches.matchedNodes = foundNodes; } } ReplaceFoundNodes(captureEvent.Replacement, foundNodes); return xdoc.ToString(); }
private void StartParsingInput(List<AdvancedRecomendation> currentlyUsedCaptures, string readText, string fileName, ComplexCaptureMatchObject complexCaptureMatchObject) { XDocument xdoc = XDocument.Parse(readText); for (int i = 0; i < currentlyUsedCaptures.Count; i++) { complexCaptureMatchObject.captureEvent = currentlyUsedCaptures[i]; currentlyUsedCaptures[i] = GetCapturePointListType(currentlyUsedCaptures[i]); List<string> foundEvents = new List<string>(); if (currentlyUsedCaptures[i].capturePointListType == CapturePointListType.SimpleList) { List<XNode> foundNodes = ParseUsingSimpleList(currentlyUsedCaptures[i], xdoc, foundEvents); totalFoundNodes = totalFoundNodes + foundNodes.Count; if (foundNodes.Count > 0) { FileAndNumberOfMatches fileAndNumberOfMatches = new FileAndNumberOfMatches(); fileAndNumberOfMatches.fileName = fileName; fileAndNumberOfMatches.matchedNodes = foundNodes; complexCaptureMatchObject.fileNamesHit.Add(fileAndNumberOfMatches); } } else { List<XNode> foundNodes = ParseUsingAdvancedList(currentlyUsedCaptures[i], xdoc); totalFoundNodes = totalFoundNodes + foundNodes.Count; if (foundNodes.Count > 0) { FileAndNumberOfMatches fileAndNumberOfMatches = new FileAndNumberOfMatches(); fileAndNumberOfMatches.fileName = fileName; fileAndNumberOfMatches.matchedNodes = foundNodes; complexCaptureMatchObject.fileNamesHit.Add(fileAndNumberOfMatches); } } } }