Esempio n. 1
0
        public SearchWrapper(FileSystemNodeSearch searchEngine, CancellationTokenSource cts, Task task)
        {
            this.searchEngine = searchEngine;
            this.cts          = cts;
            ProducerTask      = task;

            foundBuffer = new BlockingCollection <FileSystemInfo>(MAX_FOUND_BATCH_LENGTH * 2);

            searchEngine.ExceptionRise += OnExceptionRaise;
            searchEngine.NodeFound     += OnNodeFound;
            ProducerTask.ContinueWith(_ => OnSearchDone(), new CancellationToken(), TaskContinuationOptions.OnlyOnRanToCompletion | TaskContinuationOptions.DenyChildAttach, TaskScheduler.Default);

            consumer = new Consumer(this);
        }
            public static FileSystemNodeSearch CreateFromParentSearchJob(FileSystemNodeSearch parentDirSearch, DirectoryInfo dirToSearch)
            {
                var settings = new SearchSettings(parentDirSearch.Settings.Target, dirToSearch, true);

                return(new FileSystemNodeSearch(settings, parentDirSearch.NodeFound, parentDirSearch.ExceptionRise, parentDirSearch.ct));
            }