// Token: 0x06001085 RID: 4229 RVA: 0x0006036C File Offset: 0x0005E56C
        internal bool GenerateGroupList(bool delta, out bool tryAgain, IList <GroupMetricsCookie> updatedCookies)
        {
            IList <string> list = GroupMetricsGenerator.GetDomains();

            this.currentCookiePathCollection     = list.ConvertAll((string domain) => this.GetCookiePath(domain));
            this.hasDownloadedCookiesFromMailbox = false;
            bool result;

            try
            {
                using (LazyWriter lazyWriter = new LazyWriter(this.changedGroupListPath))
                {
                    foreach (string domain2 in list)
                    {
                        string             cookiePath = this.GetCookiePath(domain2);
                        GroupMetricsCookie groupMetricsCookie;
                        if (delta)
                        {
                            groupMetricsCookie = this.LoadCookie(cookiePath, domain2);
                            if (groupMetricsCookie == null)
                            {
                                tryAgain = true;
                                return(false);
                            }
                        }
                        else
                        {
                            groupMetricsCookie = new GroupMetricsCookie(domain2);
                        }
                        if (!this.GenerateChangedGroupList(domain2, groupMetricsCookie, lazyWriter, delta))
                        {
                            tryAgain = false;
                            return(false);
                        }
                        updatedCookies.Add(groupMetricsCookie);
                    }
                    if (!delta && !this.TenantHasChangedGroups())
                    {
                        this.lastSyncType = GroupMetricsSyncType.Empty;
                        GroupMetricsUtility.DeleteDirectory(this.tenantDirectory);
                    }
                    else if (!this.TenantHasChangedGroups())
                    {
                        lazyWriter.WriteLine("");
                    }
                    tryAgain = false;
                    result   = true;
                }
            }
            catch (LazyWriterException)
            {
                tryAgain = false;
                result   = false;
            }
            return(result);
        }
        // Token: 0x06001093 RID: 4243 RVA: 0x00060F1C File Offset: 0x0005F11C
        private bool GenerateChangedGroupList(string domain, GroupMetricsCookie cookie, LazyWriter changedWriter, bool delta)
        {
            DateTime dateTime = delta ? cookie.LastDeltaSync : cookie.LastFullSync;

            if (default(DateTime) != dateTime)
            {
                dateTime = dateTime.AddHours(-1.0);
            }
            DateTime utcNow = DateTime.UtcNow;

            cookie.LastDeltaSync = utcNow;
            if (!delta)
            {
                cookie.LastFullSync = utcNow;
            }
            string entriesFilePath = ADCrawler.GetEntriesFilePath(base.RunData.RunFolderPath, "DistributionList");

            try
            {
                using (XmlReader xmlReader = XmlReader.Create(entriesFilePath))
                {
                    if (xmlReader.ReadToFollowing("ADEntry"))
                    {
                        do
                        {
                            string        attribute     = xmlReader.GetAttribute(GrammarRecipientHelper.LookupProperties[2].Name);
                            string        attribute2    = xmlReader.GetAttribute(GrammarRecipientHelper.LookupProperties[0].Name);
                            Guid          guid          = new Guid(xmlReader.GetAttribute(GrammarRecipientHelper.LookupProperties[3].Name));
                            RecipientType recipientType = (RecipientType)Enum.Parse(typeof(RecipientType), xmlReader.GetAttribute(GrammarRecipientHelper.LookupProperties[4].Name));
                            string        attribute3    = xmlReader.GetAttribute(GrammarRecipientHelper.LookupProperties[7].Name);
                            string        attribute4    = xmlReader.GetAttribute(GrammarRecipientHelper.LookupProperties[8].Name);
                            base.Logger.TraceDebug(this, "GroupMetricsGenerator.GenerateChangedGroupList read AD entry - displayName='{0}', distinguishedName='{1}', smtpAddress='{2}', objectGuid='{3}', recipientType='{4}', whenChangedUTCString='{5}'", new object[]
                            {
                                attribute2,
                                attribute4,
                                attribute,
                                guid,
                                recipientType,
                                attribute3
                            });
                            DateTime utcNow2 = DateTime.UtcNow;
                            bool     flag    = GroupMetricsCookie.TryParseDateTime(attribute3, out utcNow2);
                            if (!delta || !flag || utcNow2 > dateTime || RecipientType.DynamicDistributionGroup == recipientType)
                            {
                                this.changedGroups++;
                                changedWriter.WriteLine(attribute4);
                                base.Logger.TraceDebug(this, "GroupMetricsGenerator.GenerateChangedGroupList write AD entry to changed list- displayName='{0}', distinguishedName='{1}', smtpAddress='{2}', objectGuid='{3}', recipientType='{4}', whenChangedUTCString='{5}'", new object[]
                                {
                                    attribute2,
                                    attribute4,
                                    attribute,
                                    guid,
                                    recipientType,
                                    attribute3
                                });
                            }
                        }while (xmlReader.ReadToFollowing("ADEntry"));
                    }
                }
            }
            catch (Exception ex)
            {
                this.exception = ex;
                GroupMetricsGenerator.EventLogger.LogEvent(InfoWorkerEventLogConstants.Tuple_UnableToGetListOfChangedGroupsForDomain, null, new object[]
                {
                    domain,
                    this.GetOrganizationIdString(),
                    ex.GetType().FullName,
                    ex.Message
                });
                return(false);
            }
            return(true);
        }