Пример #1
0
        private Stream GetTextBody(int length)
        {
            Item item = (Item)base.XsoItem;

            if (string.Equals(item.ClassName, "IPM.Note.SMIME", StringComparison.OrdinalIgnoreCase))
            {
                string s = Strings.SMIMENotSupportedBodyText.ToString(item.Session.PreferedCulture);
                this.textData = new MemoryStream(Encoding.UTF8.GetBytes(s));
                return(this.textData);
            }
            long num;
            IList <AttachmentLink> list;
            Stream result = BodyConversionUtilities.ConvertToPlainTextStream(item, (long)length, out num, out list);

            this.textSize = (int)num;
            return(result);
        }
Пример #2
0
        // Token: 0x06001395 RID: 5013 RVA: 0x00070AF4 File Offset: 0x0006ECF4
        public static Stream ConvertToBodyStream(Item item, long truncationSize, out long totalDataSize, out IList <AttachmentLink> attachmentLinks)
        {
            Microsoft.Exchange.Data.Storage.BodyFormat format = item.Body.Format;
            switch (format)
            {
            case Microsoft.Exchange.Data.Storage.BodyFormat.TextPlain:
                return(BodyConversionUtilities.ConvertToPlainTextStream(item, truncationSize, out totalDataSize, out attachmentLinks));

            case Microsoft.Exchange.Data.Storage.BodyFormat.TextHtml:
                return(BodyConversionUtilities.ConvertHtmlStream(item, truncationSize, out totalDataSize, out attachmentLinks));

            case Microsoft.Exchange.Data.Storage.BodyFormat.ApplicationRtf:
                return(BodyConversionUtilities.ConvertToRtfStream(item, truncationSize, out totalDataSize, out attachmentLinks));

            default:
                throw new ConversionException("Unsupported bodyFormat for this function: " + format);
            }
        }
        // Token: 0x06001447 RID: 5191 RVA: 0x00074CF4 File Offset: 0x00072EF4
        public Stream GetData(BodyType type, long truncationSize, out long totalDataSize, out IEnumerable <AirSyncAttachmentInfo> attachments)
        {
            Item item = base.XsoItem as Item;

            attachments = null;
            if (item == null)
            {
                totalDataSize = 0L;
                return(null);
            }
            IList <AttachmentLink> list = null;
            Stream stream;

            if (string.Equals(item.ClassName, "IPM.Note.SMIME", StringComparison.OrdinalIgnoreCase) && truncationSize != 0L)
            {
                switch (type)
                {
                case BodyType.PlainText:
                {
                    string s = Strings.SMIMENotSupportedBodyText.ToString(item.Session.PreferedCulture);
                    stream        = new MemoryStream(Encoding.UTF8.GetBytes(s));
                    totalDataSize = stream.Length;
                    return(stream);
                }

                case BodyType.Html:
                {
                    string s = XsoContentProperty.GetSMIMENotSupportedBodyHtml(item.Session);
                    stream        = new MemoryStream(Encoding.UTF8.GetBytes(s));
                    totalDataSize = stream.Length;
                    return(stream);
                }
                }
            }
            switch (type)
            {
            case BodyType.None:
                throw new ConversionException("Invalid body type requested");

            case BodyType.PlainText:
                stream = BodyConversionUtilities.ConvertToPlainTextStream(item, truncationSize, out totalDataSize, out list);
                break;

            case BodyType.Html:
                stream = BodyConversionUtilities.ConvertHtmlStream(item, truncationSize, out totalDataSize, out list);
                break;

            case BodyType.Rtf:
                return(this.GetRtfData(truncationSize, out totalDataSize, out list));

            case BodyType.Mime:
                throw new ConversionException("Invalid body type requested");

            default:
                stream        = null;
                totalDataSize = 0L;
                break;
            }
            if (list != null)
            {
                attachments = from attachmentLink in list
                              select new AirSyncAttachmentInfo
                {
                    AttachmentId = attachmentLink.AttachmentId,
                    IsInline     = (attachmentLink.IsMarkedInline ?? attachmentLink.IsOriginallyInline),
                    ContentId    = attachmentLink.ContentId
                };
            }
            return(stream);
        }