Exemplo n.º 1
0
        internal void ResetWorker(SearchMailboxWorker worker, bool done)
        {
            int workerId = worker.WorkerId;

            this.OverallProgress           -= this.workerProgresses[workerId] / (double)this.workerProgresses.Length;
            this.workerProgresses[workerId] = 0.0;
            if (this.OverallProgress < 0.0)
            {
                this.OverallProgress = 0.0;
            }
            if (!worker.ExcludeDuplicateMessages)
            {
                if (worker.SearchResult.ResultItemsCount == this.workerResultItems[workerId])
                {
                    this.OverallResultItems -= (long)worker.SearchResult.ResultItemsCount;
                }
                worker.SearchResult.ResultItemsCount = 0;
                this.workerResultItems[workerId]     = 0;
                if (worker.SearchResult.ResultItemsSize == this.workerResultSize[workerId])
                {
                    this.OverallResultSize -= worker.SearchResult.ResultItemsSize;
                }
                worker.SearchResult.ResultItemsSize = ByteQuantifiedSize.Zero;
                this.workerResultSize[workerId]     = ByteQuantifiedSize.Zero;
            }
            if (!done)
            {
                this.ProgressingWorkers++;
            }
            worker.LastException = null;
            worker.TargetMailbox = null;
            this.ProgressEvent.Set();
        }
Exemplo n.º 2
0
        internal void UpdateProgress(SearchMailboxWorker worker)
        {
            int workerId = worker.WorkerId;

            if (!worker.ExcludeDuplicateMessages)
            {
                int num = worker.SearchResult.ResultItemsCount - this.workerResultItems[workerId];
                this.workerResultItems[workerId] = worker.SearchResult.ResultItemsCount;
                this.OverallResultItems         += (long)num;
                ByteQuantifiedSize value = worker.SearchResult.ResultItemsSize - this.workerResultSize[workerId];
                this.workerResultSize[workerId] = worker.SearchResult.ResultItemsSize;
                this.OverallResultSize         += value;
            }
            else if (worker.TargetMailbox != null && worker.TargetSubFolderId != null)
            {
                this.UpdateResults(worker.TargetMailbox, worker.TargetSubFolderId);
            }
            double num2 = (worker.CurrentProgress - this.workerProgresses[workerId]) / (double)this.workerProgresses.Length;

            if (num2 > 0.0)
            {
                this.workerProgresses[workerId] = worker.CurrentProgress;
                this.OverallProgress           += num2;
                if (this.OverallProgress > 100.0)
                {
                    this.OverallProgress = 100.0;
                }
                this.ProgressEvent.Set();
            }
        }
 public SearchResultProcessor(MailboxSession source, MailboxSession target, StoreId targetRootId, string[] targetSubfolders, List <SearchMailboxAction> actions, ref HashSet <StoreObjectId> unsearchableItemSet, SearchCommunicator communicator, SearchMailboxWorker worker)
 {
     if (worker == null || source == null || communicator == null)
     {
         return;
     }
     this.searchWorker        = worker;
     this.searchCommunicator  = communicator;
     this.sourceMailbox       = source;
     this.targetMailbox       = target;
     this.searchActions       = actions;
     this.unsearchableItemSet = unsearchableItemSet;
     this.sourceThrottler     = new ResponseThrottler(this.searchCommunicator.AbortEvent);
     this.targetThrottler     = new ResponseThrottler(this.searchCommunicator.AbortEvent);
     this.InitializeFolderMap(targetRootId, targetSubfolders);
 }
Exemplo n.º 4
0
 internal void ReportCompletion(SearchMailboxWorker worker)
 {
     this.ProgressingWorkers--;
     this.CompletedWorkers.Add(worker);
     this.ProgressEvent.Set();
 }