Esempio n. 1
0
        public Dictionary<string, SearchResult> Search(RedlineDocument doc)
        {

            _results = new Dictionary<string, SearchResult>();

            ProcessCollection(doc, true);

            return _results;
        }
Esempio n. 2
0
 public static Dictionary<string, SearchResult> ExecuteInternal(List<string> searchTerms, RedlineDocument doc, Predicate<ChangeType> changeTypeSelector, Predicate<DocObject> contextExcluder, bool caseInsensitive = false)
 {
     RedlineStateMachine rsm = new RedlineStateMachine(caseInsensitive);
     StateMachineBuilder bld = new StateMachineBuilder(rsm);
     bld.Execute(searchTerms);
     rsm.ChangeTypeSelector = changeTypeSelector;
     rsm.ContextExcluder = contextExcluder;
     return rsm.Search(doc);
 }
Esempio n. 3
0
        public RedlineDocument Execute()
        {
            using (XmlReader reader = XmlReader.Create(m_source, new XmlReaderSettings { }))
            {
                _consumerStack = new Stack<IXmlConsumer>();
                RedlineDocument result = new RedlineDocument();
                _consumerStack.Push(result);
                reader.MoveToContent();

                ProcessNodes(reader);

                result.MoveLooseNodesIntoFirstSection();

                return result;
            }
        }
Esempio n. 4
0
        public static Dictionary<string, SearchResult> Execute(List<string> searchTerms, RedlineDocument doc, Predicate<ChangeType> changeTypeSelector, Predicate<DocObject> contextExcluder, bool caseInsensitive = false)
        {
            Dictionary<string, SearchResult> results = new Dictionary<string, SearchResult>();

            List<string> batch = new List<string>();
            for (int i = 0; i < searchTerms.Count; i++)
            {
                batch.Add(searchTerms[i]);
                if (batch.Count == 100)
                {
                    DoBatch(doc, changeTypeSelector, contextExcluder, caseInsensitive, results, batch);
                    batch.Clear();
                }

            }

            if (batch.Count>0)
                DoBatch(doc, changeTypeSelector, contextExcluder, caseInsensitive, results, batch);

            return results;


        }
Esempio n. 5
0
 public MatchingChangeFilter(RedlineDocument rd)
 {
     m_rd = rd;
 }
 public UnchangedPlaceholders(RedlineDocument rd)
 {
     m_rd = rd;
     LoadPlaceholderStrings();
 }
Esempio n. 7
0
 public static Dictionary<string, SearchResult> SearchOriginal(List<string> patterns, RedlineDocument rd, Predicate<DocObject> contextExcluder)
 {
     return Execute(patterns, rd, (ChangeType t) => Utils.IsInOriginalDocument(t), contextExcluder);
 }
Esempio n. 8
0
 private static void DoBatch(RedlineDocument doc, Predicate<ChangeType> changeTypeSelector, Predicate<DocObject> contextExcluder, bool caseInsensitive, Dictionary<string, SearchResult> results, List<string> batch)
 {
     var subResult = ExecuteInternal(batch, doc, changeTypeSelector, contextExcluder, caseInsensitive);
     MergeResults(results, subResult);
 }
 public RedlineCharPosCalculator(RedlineDocument targetDoc, IRedlineCharCounter counter)
 {
     _doc = targetDoc;
     _counter = counter;
 }
Esempio n. 10
0
 private int SearchWholeWord(string p, RedlineDocument rd)
 {
     string searchTerm = RedlineMLSearch.AnyWordBreak + p + RedlineMLSearch.AnyWordBreak;
     var result = RedlineMLSearch.Execute(new List<string>() { searchTerm }, rd, (ChangeType t) => true, (x) => false);
     Assert.AreEqual(1, result.Count);
     return result[searchTerm].Count;
 }
Esempio n. 11
0
 private DocObject FindObject(RedlineDocument rd, Location l)
 {
     DocObject result = null;
     DocObjectWithContent container = rd;
     foreach (LocationElement le in l.LocationStack)
     {
         Assert.AreSame(container, le.Container);
         result = container.Content[le.ChildIndex];
         container = result as DocObjectWithContent;
     }
     return result;
 }