// Token: 0x0600124D RID: 4685 RVA: 0x000694E0 File Offset: 0x000676E0
        public AssistantTaskContext FinishProcessingOAB(AssistantTaskContext assistantTaskContext)
        {
            OABGeneratorTaskContext oabgeneratorTaskContext = assistantTaskContext as OABGeneratorTaskContext;

            OABLogger.LogRecord(TraceType.FunctionTrace, "OABGeneratorAssistant.FinishProcessingOAB: start", new object[0]);
            try
            {
                OABLogger.LogEvent(InfoWorkerEventLogConstants.Tuple_OABGenerationCompletedGeneration, new object[]
                {
                    oabgeneratorTaskContext.CurrentOAB.ToString(),
                    oabgeneratorTaskContext.CurrentOAB.DistinguishedName,
                    oabgeneratorTaskContext.CurrentOAB.Id.ObjectGuid,
                    (oabgeneratorTaskContext.OABGenerator.Stats != null) ? oabgeneratorTaskContext.OABGenerator.Stats.GetStringForLogging() : string.Empty
                });
            }
            finally
            {
                if (oabgeneratorTaskContext.Cleanup != null)
                {
                    oabgeneratorTaskContext.Cleanup(oabgeneratorTaskContext);
                }
                oabgeneratorTaskContext.ClearPerOABData();
                OABLogger.LogRecord(TraceType.FunctionTrace, "OABGeneratorAssistant.FinishProcessingOAB: finish", new object[0]);
            }
            if (oabgeneratorTaskContext.OABsToGenerate != null && oabgeneratorTaskContext.OABsToGenerate.Count > 0)
            {
                oabgeneratorTaskContext.CurrentOAB = oabgeneratorTaskContext.OABsToGenerate.Dequeue();
                oabgeneratorTaskContext.OABStep    = new AssistantStep(this.BeginProcessingOAB);
                return(OABGeneratorTaskContext.FromOABGeneratorTaskContext(oabgeneratorTaskContext));
            }
            return(null);
        }
        // Token: 0x0600124B RID: 4683 RVA: 0x00069084 File Offset: 0x00067284
        public AssistantTaskContext InitializeOABGeneration(AssistantTaskContext assistantTaskContext)
        {
            OABGeneratorTaskContext oabgeneratorTaskContext = assistantTaskContext as OABGeneratorTaskContext;
            AssistantStep           oabstep = new AssistantStep(this.BeginProcessingOAB);

            OABLogger.LogRecord(TraceType.FunctionTrace, "OABGeneratorAssistant.InitialStep: start", new object[0]);
            OABGeneratorMailboxData oabgeneratorMailboxData = (OABGeneratorMailboxData)oabgeneratorTaskContext.Args.MailboxData;

            try
            {
                OrganizationId organizationId = oabgeneratorMailboxData.OrganizationId;
                if (organizationId == null)
                {
                    throw new ArgumentException("unable to determine organization Id");
                }
                oabgeneratorTaskContext.PerOrgAdSystemConfigSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(false, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(organizationId), 502, "InitializeOABGeneration", "f:\\15.00.1497\\sources\\dev\\MailboxAssistants\\src\\assistants\\OABGenerator\\OABGeneratorAssistant.cs");
                if (oabgeneratorMailboxData.OfflineAddressBook == Guid.Empty)
                {
                    OABLogger.LogRecord(TraceType.InfoTrace, "OABGenerator invoked for scheduled generation of OABs for Org '{0}' on DatabaseGuid={1}", new object[]
                    {
                        organizationId,
                        oabgeneratorTaskContext.Args.MailboxData.DatabaseGuid
                    });
                    oabgeneratorTaskContext.OABsToGenerate = this.GetOABsFromAD(oabgeneratorTaskContext, Guid.Empty);
                }
                else
                {
                    OABLogger.LogRecord(TraceType.InfoTrace, "OABGenerator invoked {0} for on-demand generation of OAB {1} for Org {2} DatabaseGuid={3}, MailboxGuid={4}", new object[]
                    {
                        oabgeneratorMailboxData.JobDescription,
                        oabgeneratorMailboxData.OfflineAddressBook,
                        organizationId,
                        oabgeneratorTaskContext.Args.MailboxData.DatabaseGuid,
                        oabgeneratorMailboxData.MailboxGuid
                    });
                    oabgeneratorTaskContext.OABsToGenerate = this.GetOABsFromAD(oabgeneratorTaskContext, oabgeneratorMailboxData.OfflineAddressBook);
                    if (oabgeneratorTaskContext.OABsToGenerate == null || oabgeneratorTaskContext.OABsToGenerate.Count != 1)
                    {
                        OABLogger.LogEvent(InfoWorkerEventLogConstants.Tuple_CannotFindOAB, new object[]
                        {
                            oabgeneratorMailboxData.OfflineAddressBook
                        });
                    }
                }
                if (oabgeneratorTaskContext.OABsToGenerate == null || oabgeneratorTaskContext.OABsToGenerate.Count == 0)
                {
                    OABLogger.LogRecord(TraceType.InfoTrace, "InvokeInternal. No OABs found to generate for DatabaseGuid={0}, MailboxGuid={1}", new object[]
                    {
                        oabgeneratorMailboxData.DatabaseGuid,
                        oabgeneratorMailboxData.MailboxGuid.ToString(),
                        oabgeneratorMailboxData.Guid
                    });
                    if (oabgeneratorTaskContext.Cleanup != null)
                    {
                        oabgeneratorTaskContext.Cleanup(oabgeneratorTaskContext);
                    }
                    return(null);
                }
                OABLogger.LogRecord(TraceType.InfoTrace, "Found {0} OAB(s) to generate", new object[]
                {
                    oabgeneratorTaskContext.OABsToGenerate.Count
                });
                oabgeneratorTaskContext.CurrentOAB = oabgeneratorTaskContext.OABsToGenerate.Dequeue();
            }
            finally
            {
                OABLogger.LogRecord(TraceType.FunctionTrace, "OABGeneratorAssistant.InitialStep: finish", new object[0]);
                oabgeneratorTaskContext.OABStep = oabstep;
            }
            return(OABGeneratorTaskContext.FromOABGeneratorTaskContext(oabgeneratorTaskContext));
        }