Esempio n. 1
0
        public void SearchTree(IHierarchicalTreeSearch search, IHierarchicalTreeSearchResult searchResult)
        {
            Assert.IsTrue(search.SearchPaths.Length > 0, $"Search of type {search.GetType().Name} has no paths to search.");

            foreach (var searchPath in search.SearchPaths)
            {
                var activeBranch = SearchForBranch(searchPath, false, search.Settings);
                if (activeBranch == null)
                {
                    continue;
                }

                RetrieveLeafContent(activeBranch, search, searchResult);
            }
        }
Esempio n. 2
0
        public void Remove(IHierarchicalTreeSearch search)
        {
            Assert.IsTrue(search.SearchPaths.Length > 0, $"Search of type {search.GetType().Name} has no paths to search.");

            foreach (var searchPath in search.SearchPaths)
            {
                var activeBranch = SearchForBranch(searchPath, false, search.Settings);
                if (activeBranch == null)
                {
                    continue;
                }

                activeBranch.Branches.Clear();
                activeBranch.Leaves.Clear();

                if (activeBranch.parent != null)
                {
                    activeBranch.parent.Branches.Remove(activeBranch.branchName);
                }
            }
        }