Exemple #1
0
        private void MarkInlineAttachment(string srcValue)
        {
            string contentId = HtmlUpdateBodyCallback.GetContentId(srcValue);

            if (contentId == null)
            {
                ExTraceGlobals.CommonAlgorithmTracer.TraceDebug <string>((long)this.GetHashCode(), "HtmlUpdateBodyCallback.MarkInlineAttachment. Content ID is empty for {0}", srcValue);
                return;
            }
            AttachmentId attachmentId = this.FindAttachmentId(contentId);

            if (attachmentId == null)
            {
                ExTraceGlobals.CommonAlgorithmTracer.TraceDebug <string>((long)this.GetHashCode(), "HtmlUpdateBodyCallback.MarkInlineAttachment. Attachment ID not found for {0}", srcValue);
                return;
            }
            AttachmentLink attachmentLink = base.FindAttachmentByIdOrContentId(attachmentId, contentId);

            if (attachmentLink == null)
            {
                ExTraceGlobals.CommonAlgorithmTracer.TraceDebug <string>((long)this.GetHashCode(), "HtmlUpdateBodyCallback.MarkInlineAttachment. No attachment link found for {0}", srcValue);
                return;
            }
            attachmentLink.MarkInline(true);
        }
        private static TextWriter CreateTextWriter(IItem item, BodyType type, bool update, out HtmlUpdateBodyCallback htmlUpdateBodyCallback)
        {
            Body body = IrmUtils.GetBody(item);
            BodyWriteConfiguration bodyWriteConfiguration = new BodyWriteConfiguration(type.ToStorageType());

            if (update && type == BodyType.Html)
            {
                htmlUpdateBodyCallback = new HtmlUpdateBodyCallback(item);
                bodyWriteConfiguration.SetHtmlOptions(HtmlStreamingFlags.None, htmlUpdateBodyCallback);
                return(body.OpenTextWriter(bodyWriteConfiguration));
            }
            htmlUpdateBodyCallback = null;
            return(body.OpenTextWriter(bodyWriteConfiguration));
        }