// Token: 0x06000EC9 RID: 3785 RVA: 0x00057F18 File Offset: 0x00056118
        private ADObjectId GetSourceMailbox(PublicFolderMoveRequest request)
        {
            if (request.SourceMailbox != null)
            {
                return(request.SourceMailbox);
            }
            PublicFolderMoveRequestStatistics publicFolderMoveRequestStatistics = this.GetPublicFolderMoveRequestStatistics(request, false);

            if (publicFolderMoveRequestStatistics != null)
            {
                return(publicFolderMoveRequestStatistics.SourceMailbox);
            }
            return(null);
        }
        // Token: 0x06000ED0 RID: 3792 RVA: 0x00058534 File Offset: 0x00056734
        private PublicFolderMoveRequestStatistics GetPublicFolderMoveRequestStatistics(PublicFolderMoveRequest moveRequest, bool includeReport)
        {
            PSCommand cmd = new PSCommand();

            cmd.AddCommand("Get-PublicFolderMoveRequestStatistics");
            cmd.AddParameter("Identity", moveRequest.Identity);
            if (includeReport)
            {
                cmd.AddParameter("IncludeReport");
            }
            PublicFolderMoveRequestStatistics moveRequestStats = null;

            PublicFolderSplitHelper.PowerShellExceptionHandler(delegate(out string originOfException, out ErrorRecord error)
            {
                originOfException = "MoveContentOperation::GetPublicFolderMoveRequestStatistics - RunPSCommand - Get-PublicFolderMoveRequestStatistics";
                IAssistantRunspaceProxy assistantRunspaceProxy = this.powershellFactory.CreateRunspaceForDatacenterAdmin(this.CurrentPublicFolderSession.OrganizationId);
                moveRequestStats = assistantRunspaceProxy.RunPSCommand <PublicFolderMoveRequestStatistics>(cmd, out error, this.logger);
            }, this.splitOperationState);
            return(moveRequestStats);
        }
        // Token: 0x06000EC8 RID: 3784 RVA: 0x00057C9C File Offset: 0x00055E9C
        private bool TryHandleExistingRequest(PublicFolderMoveRequest existingRequest)
        {
            bool result = true;

            if (existingRequest != null)
            {
                result = false;
                ADObjectId sourceMailbox = this.GetSourceMailbox(existingRequest);
                if (this.IsMoveRequestInteresting(existingRequest, sourceMailbox))
                {
                    this.logger.LogEvent(LogEventType.Verbose, string.Format("MoveContentOperation::InvokeInternal - Existing move request found for the current mailbox '{0}\\{1}'. Its status is {2}", base.CurrentPublicFolderSession.OrganizationId.OrganizationalUnit.Name, base.CurrentPublicFolderSession.MailboxGuid.ToString(), existingRequest.Status.ToString()));
                    RequestStatus status = existingRequest.Status;
                    switch (status)
                    {
                    case RequestStatus.Queued:
                    case RequestStatus.InProgress:
                    case RequestStatus.CompletionInProgress:
                        this.logger.LogEvent(LogEventType.Verbose, "MoveContentOperation::InvokeInternal - Waiting for the existing move request to complete. Exiting MoveContentOperation.");
                        this.splitOperationState.Error = new PublicFolderMoveInProgressException();
                        return(result);

                    case RequestStatus.AutoSuspended:
                    case RequestStatus.Synced:
                        break;

                    case (RequestStatus)6:
                    case (RequestStatus)7:
                    case (RequestStatus)8:
                    case (RequestStatus)9:
                        goto IL_20E;

                    case RequestStatus.Completed:
                    case RequestStatus.CompletedWithWarning:
                        this.RemovePublicFolderMoveRequest(existingRequest);
                        if (this.splitOperationState.Error != null)
                        {
                            return(result);
                        }
                        this.logger.LogEvent(LogEventType.Verbose, "MoveContentOperation::InvokeInternal - Removed the successfully completed move request.");
                        this.ResetIsExcludedFromServingHierarchy();
                        if (this.splitOperationState.Error == null)
                        {
                            this.logger.LogEvent(LogEventType.Verbose, string.Format("MoveContentOperation::InvokeInternal - Successfully reset the IsExcludedFromServingHierarchy flag on the mailbox '{0}\\{1}'.", base.CurrentPublicFolderSession.OrganizationId.OrganizationalUnit.Name, base.CurrentPublicFolderSession.MailboxGuid.ToString()));
                            return(result);
                        }
                        return(result);

                    default:
                        switch (status)
                        {
                        case RequestStatus.Suspended:
                            break;

                        case RequestStatus.Failed:
                        {
                            PublicFolderMoveRequestStatistics publicFolderMoveRequestStatistics = this.GetPublicFolderMoveRequestStatistics(existingRequest, true);
                            if (publicFolderMoveRequestStatistics != null && publicFolderMoveRequestStatistics.Report != null && publicFolderMoveRequestStatistics.Report.Failures != null && publicFolderMoveRequestStatistics.Report.Failures.Count > 0)
                            {
                                this.splitOperationState.Error = new PublicFolderMoveFailedException(publicFolderMoveRequestStatistics.Report.Failures[publicFolderMoveRequestStatistics.Report.Failures.Count - 1].FailureType);
                                return(result);
                            }
                            this.splitOperationState.Error = new PublicFolderMoveFailedException(string.Empty);
                            return(result);
                        }

                        default:
                            goto IL_20E;
                        }
                        break;
                    }
                    this.splitOperationState.Error = new PublicFolderMoveSuspendedException();
                    return(result);

IL_20E:
                    this.splitOperationState.Error = new UnexpectedMoveStateException(existingRequest.Status.ToString());
                }
                else
                {
                    this.splitOperationState.PartialStep = true;
                    this.logger.LogEvent(LogEventType.Verbose, string.Format("MoveContentOperation::InvokeInternal - Existing move request found for a different mailbox '{0}\\{1}' . The move operation will resume after it is removed.", existingRequest.OrganizationId.ToString(), (sourceMailbox != null) ? sourceMailbox.ToString() : string.Empty));
                }
            }
            return(result);
        }