Esempio n. 1
0
        // Token: 0x06001074 RID: 4212 RVA: 0x0005FDBC File Offset: 0x0005DFBC
        public static bool TryDeserialize(string record, out GroupMetricsCookie cookie)
        {
            cookie = null;
            string[] array = record.Split(GroupMetricsCookie.RecordSeparator, 3);
            if (3 != array.Length)
            {
                return(false);
            }
            DateTime lastDeltaSync;

            if (!GroupMetricsCookie.TryParseDateTime(array[1], out lastDeltaSync))
            {
                return(false);
            }
            DateTime lastFullSync;

            if (!GroupMetricsCookie.TryParseDateTime(array[2], out lastFullSync))
            {
                return(false);
            }
            cookie = new GroupMetricsCookie(array[0]);
            cookie.LastDeltaSync = lastDeltaSync;
            cookie.LastFullSync  = lastFullSync;
            return(true);
        }
        // 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);
        }