示例#1
0
        private void RestoreInlineAttachment(HtmlTagContextAttribute filterAttribute, HtmlTagContext context, HtmlWriter writer)
        {
            string text  = filterAttribute.Value;
            string value = filterAttribute.Value;

            text = HttpUtility.UrlDecode(text);
            if (!string.IsNullOrEmpty(text))
            {
                int num = value.IndexOf(OwaSafeHtmlCallbackBase.AttachmentBaseUrl, StringComparison.Ordinal);
                if (num != -1 && this.Item != null && this.Item.Id != null)
                {
                    if (AttachmentUtility.VerifyInlineAttachmentUrlValidity(value, this.item))
                    {
                        int            contentIdIndex;
                        string         contentId          = AttachmentUtility.ParseInlineAttachmentContentId(text, out contentIdIndex);
                        string         attachmentIdString = AttachmentUtility.ParseInlineAttachmentIdString(text, contentIdIndex);
                        AttachmentLink attachmentLink     = AttachmentUtility.GetAttachmentLink(attachmentIdString, contentId, this.item, this);
                        if (attachmentLink != null)
                        {
                            filterAttribute.WriteName();
                            writer.WriteAttributeValue(this.inlineHTMLAttachmentScheme + AttachmentUtility.GetOrGenerateAttachContentId(attachmentLink));
                            return;
                        }
                    }
                }
                else
                {
                    if (text.IndexOf(OwaSafeHtmlCallbackBase.blankImageFileName, StringComparison.Ordinal) != -1)
                    {
                        filterAttribute.WriteName();
                        writer.WriteAttributeValue(OwaSafeHtmlCallbackBase.DoubleBlank);
                        return;
                    }
                    filterAttribute.Write();
                }
            }
        }