Exemplo n.º 1
0
        // Token: 0x06000319 RID: 793 RVA: 0x00013E08 File Offset: 0x00012008
        internal ItemAuditLogData(object[] row, PropertyIndexHolder propertyIndexHolder, FolderAuditLogData folderAuditLogData)
        {
            if (propertyIndexHolder.MessageSubjectIndex >= 0)
            {
                this.messageSubject = (row[propertyIndexHolder.MessageSubjectIndex] as string);
            }
            this.messageSender = (row[propertyIndexHolder.MessageSenderIndex] as string);
            string text = row[propertyIndexHolder.MessageSentRepresentingIndex] as string;

            if (!string.IsNullOrEmpty(text) && !text.Equals(this.messageSender, StringComparison.InvariantCultureIgnoreCase))
            {
                this.messageSender = this.messageSender + " sent on behalf of " + text;
            }
            this.messageInternetId  = (row[propertyIndexHolder.MessageInternetIdIndex] as string);
            this.messageClass       = (row[propertyIndexHolder.ItemClassIndex] as string);
            this.folderAuditLogData = folderAuditLogData;
        }
        // Token: 0x0600037C RID: 892 RVA: 0x000180B4 File Offset: 0x000162B4
        internal override void Invoke(ProvisionedFolder provisionedFolder, List <object[]> items, PropertyIndexHolder propertyIndexHolder)
        {
            FolderExpirationExecutor folderExpirationExecutor = new FolderExpirationExecutor(provisionedFolder, base.MailboxData, base.Assistant);

            ExpirationEnforcer.Tracer.TraceDebug <object, string, int>((long)this.GetHashCode(), "{0}: Number of items found in folder '{1}' is {2}.", TraceContext.Get(), provisionedFolder.DisplayName, items.Count);
            DefaultFolderType folderType = DefaultFolderType.None;

            if (provisionedFolder.FolderId.Equals(base.MailboxData.MailboxSession.GetDefaultFolderId(DefaultFolderType.DeletedItems)))
            {
                folderType = DefaultFolderType.DeletedItems;
            }
            else if (provisionedFolder.ContainerClass != null && ObjectClass.IsCalendarFolder(provisionedFolder.ContainerClass))
            {
                folderType = DefaultFolderType.Calendar;
            }
            else if (provisionedFolder.ContainerClass != null && ObjectClass.IsTaskFolder(provisionedFolder.ContainerClass))
            {
                folderType = DefaultFolderType.Tasks;
            }
            ItemStartDateCalculator itemStartDateCalculator = new ItemStartDateCalculator(propertyIndexHolder, provisionedFolder.Folder.DisplayName, folderType, base.MailboxData.MailboxSession, ExpirationEnforcer.Tracer);
            FolderAuditLogData      folderAuditLogData      = null;

            if (base.MailboxData.ElcAuditLog.ExpirationLoggingEnabled)
            {
                folderAuditLogData = new FolderAuditLogData(provisionedFolder, base.MailboxData, ELCAction.Retention.ToString());
            }
            foreach (object[] array in items)
            {
                VersionedId versionedId = array[propertyIndexHolder.IdIndex] as VersionedId;
                string      text        = array[propertyIndexHolder.ItemClassIndex] as string;
                if (versionedId == null)
                {
                    ExpirationEnforcer.Tracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Current item in folder {1} is null. Skipping it.", TraceContext.Get(), provisionedFolder.DisplayName);
                }
                else
                {
                    provisionedFolder.CurrentItems = new VersionedId[]
                    {
                        versionedId
                    };
                    text = ((text == null) ? string.Empty : text.ToLower());
                    ContentSetting contentSetting = null;
                    contentSetting = ElcPolicySettings.GetApplyingPolicy(provisionedFolder.ElcPolicies, text, provisionedFolder.ItemClassToPolicyMapping);
                    if (contentSetting == null)
                    {
                        ExpirationEnforcer.Tracer.TraceDebug <object, string, string>((long)this.GetHashCode(), "{0}: Policy for item class {1} in folder {2} is null. Skipping item.", TraceContext.Get(), text, provisionedFolder.DisplayName);
                    }
                    else if (!base.MailboxData.FolderProcessor.IsPolicyValid(provisionedFolder, contentSetting, text, base.MailboxData))
                    {
                        ExpirationEnforcer.Tracer.TraceDebug <object, string, string>((long)this.GetHashCode(), "{0}: Removing policy {1} from the list in folder {2} because it is invalid.", TraceContext.Get(), contentSetting.Name, provisionedFolder.DisplayName);
                        provisionedFolder.RemovePolicy(contentSetting);
                    }
                    else
                    {
                        double totalDays = contentSetting.AgeLimitForRetention.Value.TotalDays;
                        int    num;
                        if (contentSetting.TriggerForRetention == RetentionDateType.WhenMoved)
                        {
                            ExpirationEnforcer.Tracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Applying policy. Policy '{1}' expires based on move date.", TraceContext.Get(), contentSetting.Name);
                            CompositeProperty compositeProperty = null;
                            if (ElcMailboxHelper.Exists(array[propertyIndexHolder.MoveDateIndex]))
                            {
                                try
                                {
                                    compositeProperty = CompositeProperty.Parse((byte[])array[propertyIndexHolder.MoveDateIndex]);
                                }
                                catch (ArgumentException ex)
                                {
                                    ExpirationEnforcer.Tracer.TraceError((long)this.GetHashCode(), "{0}: Could not parse move date property of item. Folder: {1} ItemClass: {2} Exception: {3}.", new object[]
                                    {
                                        TraceContext.Get(),
                                        provisionedFolder.DisplayName,
                                        text,
                                        ex
                                    });
                                    base.MailboxData.ThrowIfErrorsOverLimit();
                                }
                            }
                            if (compositeProperty == null)
                            {
                                string arg = "Stamped Move date is null.";
                                ExpirationEnforcer.Tracer.TraceDebug <object, VersionedId, string>((long)this.GetHashCode(), "{0}: Move date needs to be stamped on item {1}. {2}", TraceContext.Get(), versionedId, arg);
                                folderExpirationExecutor.AddToMoveDateStampingList(new ItemData(versionedId, (int)array[propertyIndexHolder.SizeIndex]));
                                continue;
                            }
                            ExpirationEnforcer.Tracer.TraceDebug <object, VersionedId>((long)this.GetHashCode(), "{0}: Calculating age of item {1} based on move date", TraceContext.Get(), versionedId);
                            num = (int)base.MailboxData.Now.Subtract(compositeProperty.Date.Value).TotalDays;
                        }
                        else
                        {
                            DateTime startDate = itemStartDateCalculator.GetStartDate(versionedId, text, array);
                            if (startDate == DateTime.MinValue)
                            {
                                num = 0;
                            }
                            else
                            {
                                num = (int)base.MailboxData.UtcNow.Subtract(startDate).TotalDays;
                            }
                        }
                        try
                        {
                            if ((double)num >= totalDays)
                            {
                                if (contentSetting.RetentionAction == RetentionActionType.MarkAsPastRetentionLimit && array[propertyIndexHolder.ExpiryTimeIndex] != null && !(array[propertyIndexHolder.ExpiryTimeIndex] is PropertyError))
                                {
                                    ExpirationEnforcer.Tracer.TraceDebug <object, VersionedId>((long)this.GetHashCode(), "{0}: Item {1} is already tagged with expiry time, hence will not tag again.", TraceContext.Get(), versionedId);
                                }
                                else
                                {
                                    ExpirationEnforcer.Tracer.TraceDebug <object, VersionedId>((long)this.GetHashCode(), "{0}: Adding item {1} to list to be expired.", TraceContext.Get(), versionedId);
                                    ItemAuditLogData itemAuditLogData = null;
                                    if (base.MailboxData.ElcAuditLog.ExpirationLoggingEnabled)
                                    {
                                        folderAuditLogData.ExpirationAction = contentSetting.RetentionAction.ToString();
                                        itemAuditLogData = new ItemAuditLogData(array, propertyIndexHolder, folderAuditLogData);
                                    }
                                    ItemData itemData = new ItemData(versionedId, (array[propertyIndexHolder.ReceivedTimeIndex] is ExDateTime) ? ((DateTime)((ExDateTime)array[propertyIndexHolder.ReceivedTimeIndex])) : DateTime.MinValue, itemAuditLogData, (int)array[propertyIndexHolder.SizeIndex]);
                                    folderExpirationExecutor.AddToReportAndDoomedList(array, propertyIndexHolder, contentSetting, itemData, text, this.allPolicyTags);
                                }
                            }
                        }
                        catch (InvalidExpiryDestinationException ex2)
                        {
                            ExpirationEnforcer.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Removing policy '{1}', that applies to folder '{2}' from list of policies to process. Exception: {3}", new object[]
                            {
                                TraceContext.Get(),
                                contentSetting.Name,
                                contentSetting.ManagedFolderName,
                                ex2
                            });
                            provisionedFolder.RemovePolicy(contentSetting);
                        }
                        catch (SkipFolderException ex3)
                        {
                            ExpirationEnforcer.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Policy '{1}', that applies to folder '{2}' will be skipped for the current folder. Exception: {3}", new object[]
                            {
                                TraceContext.Get(),
                                contentSetting.Name,
                                contentSetting.ManagedFolderName,
                                ex3
                            });
                            return;
                        }
                    }
                }
            }
            ExpirationEnforcer.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Done identifying items for expiration. Proceed to expire.", new object[]
            {
                TraceContext.Get()
            });
            ExpirationEnforcer.TracerPfd.TracePfd <int, object>((long)this.GetHashCode(), "PFD IWE {0} {1}: Done identifying items for expiration. Calling ExpirationExecutor to expire.", 26903, TraceContext.Get());
            folderExpirationExecutor.ExecuteTheDoomed();
        }