Пример #1
0
        /// <summary>
        /// Get the corresponding AbstractFastTransferStream.
        /// </summary>
        /// <returns>The corresponding AbstractFastTransferStream.</returns>
        public AbstractFastTransferStream GetAbstractFastTransferStream()
        {
            AbstractFastTransferStream abstractFastTransferStream = new AbstractFastTransferStream
            {
                StreamType = FastTransferStreamType.MessageContent
            };

            AbstractMessageContent abstractMessageContent = new AbstractMessageContent();

            if (this.PropList != null && this.PropList.PropValues.Count > 0)
            {
                // Check the propList of MessageContent if one PropValue is a PtypString value,
                // the StringPropertiesInUnicode of the AbstractMessageContent is true.
                for (int i = 0; i < this.PropList.PropValues.Count; i++)
                {
                    PropValue p = this.PropList.PropValues[i];
                    if (p.PropType == 0x1f)
                    {
                        abstractMessageContent.StringPropertiesInUnicode = true;
                        break;
                    }
                }

                for (int i = 0; i < this.PropList.PropValues.Count; i++)
                {
                    PropValue p = this.PropList.PropValues[i];

                    // If server stored the string using Unicode, the code page property type should be 0x84B0, which specifies the Unicode (1200) code page, specified in section 2.2.4.1.1.1.
                    if (p.PropType == 0x84b0)
                    {
                        abstractMessageContent.StringPropertiesInUnicodeCodePage = true;
                        break;
                    }
                }

                for (int i = 0; i < this.PropList.PropValues.Count; i++)
                {
                    PropValue p = this.PropList.PropValues[i];

                    // If server supports other formats (not Unicode), the PropType should not be 0X84b0, which specifies the Unicode (1200) code page, specified in section 2.2.4.1.1.1.
                    if (p.PropType - 0x8000 >= 0 && p.PropType != 0x84b0)
                    {
                        abstractMessageContent.StringPropertiesInOtherCodePage = true;
                        break;
                    }
                }
            }
            else if (this.MessageChildren != null)
            {
                // Check the propList of MessageContent if one PropValue is a PtypString value,
                // the StringPropertiesInUnicode of the AbstractMessageContent is true.
                foreach (Recipient rec in this.MessageChildren.Recipients)
                {
                    if (rec.PropList.HasPropertyType(0x1f))
                    {
                        abstractMessageContent.StringPropertiesInUnicode = true;
                        break;
                    }

                    // If server stored the string using Unicode, the code page property type should be 0x84B0, which specifies the Unicode (1200) code page, specified in section 2.2.4.1.1.1.
                    if (rec.PropList.HasPropertyType(0x84b0))
                    {
                        abstractMessageContent.StringPropertiesInUnicodeCodePage = true;
                        break;
                    }

                    for (int i = 0; i < rec.PropList.PropValues.Count; i++)
                    {
                        // If server supports other formats (not Unicode), the PropType should not be 0X84b0, which specifies the Unicode (1200) code page, specified in section 2.2.4.1.1.1.
                        if (rec.PropList.PropValues[i].PropType - 0x8000 >= 0 && rec.PropList.PropValues[i].PropType != 0x84b0)
                        {
                            abstractMessageContent.StringPropertiesInOtherCodePage = true;
                            break;
                        }
                    }
                }
            }
            else
            {
                abstractMessageContent.StringPropertiesInUnicode = false;
            }

            if (this.MessageChildren != null)
            {
                // If MessageChildren contains attachments check whether attachments Preceded By PidTagFXDelProp.
                if (this.MessageChildren.Attachments != null && this.MessageChildren.Attachments.Count > 0)
                {
                    abstractMessageContent.AbsMessageChildren.AttachmentPrecededByPidTagFXDelProp
                        = this.MessageChildren.FXDelPropsBeforeAttachment != null &&
                          this.MessageChildren.FXDelPropsBeforeAttachment.Count > 0;
                }

                if (this.MessageChildren.Recipients != null && this.MessageChildren.Recipients.Count > 0)
                {
                    abstractMessageContent.AbsMessageChildren.RecipientPrecededByPidTagFXDelProp
                        = this.MessageChildren.FXDelPropsBeforeRecipient != null &&
                          this.MessageChildren.FXDelPropsBeforeRecipient.Count > 0;
                }
            }

            abstractFastTransferStream.AbstractMessageContent = abstractMessageContent;
            return(abstractFastTransferStream);
        }
        /// <summary>
        /// Get the corresponding AbstractFastTransferStream.
        /// </summary>
        /// <returns>The corresponding AbstractFastTransferStream.</returns>
        public AbstractFastTransferStream GetAbstractFastTransferStream()
        {
            AbstractFastTransferStream abstractFastTransferStream = new AbstractFastTransferStream
            {
                StreamType = FastTransferStreamType.MessageContent
            };

            AbstractMessageContent abstractMessageContent = new AbstractMessageContent();

            if (this.PropList != null && this.PropList.PropValues.Count > 0)
            {
                // Check the propList of MessageContent if one PropValue is a PtypString value, 
                // the StringPropertiesInUnicode of the AbstractMessageContent is true.
                for (int i = 0; i < this.PropList.PropValues.Count; i++)
                {
                    PropValue p = this.PropList.PropValues[i];
                    if (p.PropType == 0x1f)
                    {
                        abstractMessageContent.StringPropertiesInUnicode = true;
                        break;
                    }
                }

                for (int i = 0; i < this.PropList.PropValues.Count; i++)
                {
                    PropValue p = this.PropList.PropValues[i];

                    // If server stored the string using Unicode, the code page property type should be 0x84B0, which specifies the Unicode (1200) code page, specified in section 2.2.4.1.1.1. 
                    if (p.PropType == 0x84b0)
                    {
                        abstractMessageContent.StringPropertiesInUnicodeCodePage = true;
                        break;
                    }
                }

                for (int i = 0; i < this.PropList.PropValues.Count; i++)
                {
                    PropValue p = this.PropList.PropValues[i];

                    // If server supports other formats (not Unicode), the PropType should not be 0X84b0, which specifies the Unicode (1200) code page, specified in section 2.2.4.1.1.1.
                    if (p.PropType - 0x8000 >= 0 && p.PropType != 0x84b0)
                    {
                        abstractMessageContent.StringPropertiesInOtherCodePage = true;
                        break;
                    }
                }
            }
            else if (this.MessageChildren != null)
            {
                // Check the propList of MessageContent if one PropValue is a PtypString value, 
                // the StringPropertiesInUnicode of the AbstractMessageContent is true.
                foreach (Recipient rec in this.MessageChildren.Recipients)
                {
                    if (rec.PropList.HasPropertyType(0x1f))
                    {
                        abstractMessageContent.StringPropertiesInUnicode = true;
                        break;
                    }

                    // If server stored the string using Unicode, the code page property type should be 0x84B0, which specifies the Unicode (1200) code page, specified in section 2.2.4.1.1.1. 
                    if (rec.PropList.HasPropertyType(0x84b0))
                    {
                        abstractMessageContent.StringPropertiesInUnicodeCodePage = true;
                        break;
                    }

                    for (int i = 0; i < rec.PropList.PropValues.Count; i++)
                    {
                        // If server supports other formats (not Unicode), the PropType should not be 0X84b0, which specifies the Unicode (1200) code page, specified in section 2.2.4.1.1.1.
                        if (rec.PropList.PropValues[i].PropType - 0x8000 >= 0 && rec.PropList.PropValues[i].PropType != 0x84b0)
                        {
                            abstractMessageContent.StringPropertiesInOtherCodePage = true;
                            break;
                        }
                    }
                }
            }
            else
            {
                abstractMessageContent.StringPropertiesInUnicode = false;
            }

            if (this.MessageChildren != null)
            {
                // If MessageChildren contains attachments check whether attachments Preceded By PidTagFXDelProp.
                if (this.MessageChildren.Attachments != null && this.MessageChildren.Attachments.Count > 0)
                {
                    abstractMessageContent.AbsMessageChildren.AttachmentPrecededByPidTagFXDelProp
                         = this.MessageChildren.FXDelPropsBeforeAttachment != null
                         && this.MessageChildren.FXDelPropsBeforeAttachment.Count > 0;
                }

                if (this.MessageChildren.Recipients != null && this.MessageChildren.Recipients.Count > 0)
                {
                    abstractMessageContent.AbsMessageChildren.RecipientPrecededByPidTagFXDelProp
                        = this.MessageChildren.FXDelPropsBeforeRecipient != null
                        && this.MessageChildren.FXDelPropsBeforeRecipient.Count > 0;
                }
            }

            abstractFastTransferStream.AbstractMessageContent = abstractMessageContent;
            return abstractFastTransferStream;
        }