コード例 #1
0
        private bool CanExtractItemPart(IConversationTree conversationTree, IStorePropertyBag propertyBag, out ParticipantTable recipientTable, out List <Participant> replyToParticipants)
        {
            IConversationTreeNode treeNode = null;
            StoreObjectId         objectId = ((VersionedId)propertyBag.TryGetProperty(ItemSchema.Id)).ObjectId;

            recipientTable      = null;
            replyToParticipants = null;
            if (!conversationTree.TryGetConversationTreeNode(objectId, out treeNode))
            {
                throw new ArgumentException("No ConversationTreeNode can be found for the passed StorePropertyBag");
            }
            if (this.itemParts.ContainsKey(objectId))
            {
                return(true);
            }
            if (this.OnBeforeItemLoad != null)
            {
                LoadItemEventArgs loadItemEventArgs = new LoadItemEventArgs(treeNode, propertyBag);
                this.OnBeforeItemLoad(this, loadItemEventArgs);
                if (loadItemEventArgs.MessagePropertyDefinitions != null)
                {
                    foreach (PropertyDefinition propertyDefinition in loadItemEventArgs.MessagePropertyDefinitions)
                    {
                        ICollection <PropertyDefinition> requiredPropertyDefinitionsWhenReading = propertyDefinition.RequiredPropertyDefinitionsWhenReading;
                        foreach (PropertyDefinition propertyDefinition2 in requiredPropertyDefinitionsWhenReading)
                        {
                            if (!conversationTree.IsPropertyLoaded(propertyDefinition2) && !ConversationDataExtractor.nonNativePropertiesCanBeExtracted.Contains(propertyDefinition2) && !ConversationDataExtractor.BodyPropertiesCanBeExtracted.Contains(propertyDefinition2))
                            {
                                this.optimizationInfo.UpdateItemExtraPropertiesNeeded(objectId);
                                return(false);
                            }
                        }
                    }
                }
            }
            if (true.Equals(propertyBag.TryGetProperty(StoreObjectSchema.IsRestricted)))
            {
                this.optimizationInfo.UpdateItemIrmProtected(objectId);
                return(false);
            }
            if (true.Equals(propertyBag.TryGetProperty(InternalSchema.MapiHasAttachment)))
            {
                if (true.Equals(propertyBag.TryGetProperty(ItemSchema.HasAttachment)))
                {
                    this.optimizationInfo.UpdateItemAttachmentPresent(objectId);
                }
                this.optimizationInfo.UpdateItemMapiAttachmentPresent(objectId);
                return(false);
            }
            recipientTable      = new ParticipantTable();
            replyToParticipants = new List <Participant>();
            if (!this.TryExtractRecipients(propertyBag, recipientTable, replyToParticipants))
            {
                this.optimizationInfo.UpdateItemParticipantNotFound(objectId);
                return(false);
            }
            return(true);
        }
コード例 #2
0
        private void LoadItemPart(IConversationTree conversationTree, IStorePropertyBag propertyBag)
        {
            StoreObjectId objectId = ((VersionedId)propertyBag.TryGetProperty(ItemSchema.Id)).ObjectId;

            if (this.loadedItemParts.ContainsKey(objectId))
            {
                return;
            }
            IConversationTreeNode treeNode = null;

            if (!conversationTree.TryGetConversationTreeNode(objectId, out treeNode))
            {
                throw new ArgumentException("No ConversationTreeNode can be found for the passed StorePropertyBag");
            }
            LoadItemEventArgs loadItemEventArgs = new LoadItemEventArgs(treeNode, propertyBag);

            PropertyDefinition[] array = null;
            if (this.OnBeforeItemLoad != null)
            {
                this.OnBeforeItemLoad(this, loadItemEventArgs);
                if (loadItemEventArgs.OpportunisticLoadPropertyDefinitions != null && loadItemEventArgs.MessagePropertyDefinitions != null)
                {
                    array = new PropertyDefinition[loadItemEventArgs.OpportunisticLoadPropertyDefinitions.Length + loadItemEventArgs.MessagePropertyDefinitions.Length];
                    loadItemEventArgs.MessagePropertyDefinitions.CopyTo(array, 0);
                    loadItemEventArgs.OpportunisticLoadPropertyDefinitions.CopyTo(array, loadItemEventArgs.MessagePropertyDefinitions.Length);
                }
                else if (loadItemEventArgs.OpportunisticLoadPropertyDefinitions != null)
                {
                    array = loadItemEventArgs.OpportunisticLoadPropertyDefinitions;
                }
                else
                {
                    array = loadItemEventArgs.MessagePropertyDefinitions;
                }
            }
            LoadedItemPart loadedItemPart = this.itemPartLoader.Load(propertyBag[ItemSchema.Id] as StoreId, propertyBag, loadItemEventArgs.HtmlStreamOptionCallback, array, this.bytesLoadedForConversation, this.isSmimeSupported, this.domainName);

            if (loadedItemPart.DidLoadSucceed)
            {
                this.bytesLoadedForConversation += loadedItemPart.BytesLoaded;
            }
            this.loadedItemParts.Add(objectId, loadedItemPart);
            this.AddRecipientToRecipientDisplayNameCache(this.loadedItemParts[objectId]);
            this.optimizationInfo.UpdateItemOpened(objectId);
            if (propertyBag.TryGetProperty(InternalSchema.MapiHasAttachment).Equals(true))
            {
                this.optimizationInfo.UpdateItemMapiAttachmentPresent(objectId);
                if (propertyBag.TryGetProperty(ItemSchema.HasAttachment).Equals(true))
                {
                    this.optimizationInfo.UpdateItemAttachmentPresent(objectId);
                }
            }
            if (!this.itemParts.ContainsKey(objectId))
            {
                this.itemParts.Add(objectId, this.loadedItemParts[objectId]);
                return;
            }
            this.loadedItemParts[objectId].UniqueFragmentInfo     = this.itemParts[objectId].UniqueFragmentInfo;
            this.loadedItemParts[objectId].DisclaimerFragmentInfo = this.itemParts[objectId].DisclaimerFragmentInfo;
            this.itemParts[objectId] = this.loadedItemParts[objectId];
        }