예제 #1
0
        // Token: 0x0600015E RID: 350 RVA: 0x00005644 File Offset: 0x00003844
        internal override bool Process(JobCache data)
        {
            AnchorUtil.ThrowOnNullArgument(data, "data");
            if (base.LastRunTime == null)
            {
                TimeSpan config = base.Context.Config.GetConfig <TimeSpan>("ScannerInitialTimeDelay");
                if (!config.Equals(TimeSpan.Zero))
                {
                    base.Context.Logger.Log(MigrationEventType.Information, "Sleeping initial delay of {0} on start", new object[]
                    {
                        config
                    });
                    base.StopEvent.WaitOne(config, false);
                }
            }
            this.nextProcessTime = ExDateTime.UtcNow.Add(base.Context.Config.GetConfig <TimeSpan>("ScannerTimeDelay"));
            if (base.Context.Config.GetConfig <bool>("ScannerClearCacheOnRefresh"))
            {
                data.Clear();
            }
            int num  = 0;
            int num2 = 0;
            int num3 = 0;
            HashSet <ADObjectId> hashSet = new HashSet <ADObjectId>();

            foreach (ADUser aduser in this.GetLocalMailboxUsers())
            {
                hashSet.Add(aduser.ObjectId);
                bool flag = data.Contains(aduser.ObjectId);
                if (data.TryAdd(aduser, false))
                {
                    if (flag)
                    {
                        num2++;
                    }
                    else
                    {
                        num++;
                    }
                }
                else if (flag)
                {
                    num3++;
                }
            }
            foreach (CacheEntryBase cacheEntryBase in data.Get())
            {
                if (!hashSet.Contains(cacheEntryBase.ObjectId))
                {
                    if (data.TryUpdate(cacheEntryBase, false))
                    {
                        num2++;
                    }
                    else
                    {
                        num3++;
                    }
                }
            }
            this.diagnosticMessage = string.Format(" Modified {0}, Added {1}, removed {2} cache entries", num2, num, num3);
            if (num > 0 || num3 > 0)
            {
                base.Context.Logger.Log(MigrationEventType.Information, this.diagnosticMessage, new object[0]);
            }
            else
            {
                base.Context.Logger.Log(MigrationEventType.Verbose, this.diagnosticMessage, new object[0]);
            }
            return(false);
        }