private void SearchRecursive(FileElement element, string term, SearchOptions options, ref HashSet <long> result, bool autoAdd) { if (term == null) { return; } bool shouldAdd = autoAdd; if (!shouldAdd) { var tokens = term .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) .Select(t => t.Trim()); shouldAdd = true; foreach (var token in tokens) { shouldAdd = shouldAdd && element.RawText.Contains(token, StringComparison.InvariantCultureIgnoreCase); } } if (shouldAdd) { result.Add(element.ParagraphNumber); } foreach (var child in element.Children) { SearchRecursive(child, term, options, ref result, shouldAdd); } }
public void MapElements(FileElement element) { if (ElementsByParagraphId == null) { ElementsByParagraphId = new Dictionary <long, FileElement>(); } ElementsByParagraphId[element.ParagraphNumber] = element; foreach (var child in element.Children) { MapElements(child); } }
internal abstract void AddTo(FileElement element);