コード例 #1
0
        // Token: 0x06002AA2 RID: 10914 RVA: 0x000EF20C File Offset: 0x000ED40C
        protected void RenderContactPicture()
        {
            if (base.Item.AttachmentCollection == null)
            {
                return;
            }
            string text = string.Empty;
            string contactPictureAttachmentId = RenderingUtilities.GetContactPictureAttachmentId(base.Item);

            if (!string.IsNullOrEmpty(contactPictureAttachmentId))
            {
                if (base.IsEmbeddedItemInNonSMimeItem)
                {
                    text = base.RenderEmbeddedUrl() + Utilities.UrlEncode(contactPictureAttachmentId);
                }
                else
                {
                    text = RenderingUtilities.GetContactPictureUrl(Utilities.GetIdAsString(base.Item), contactPictureAttachmentId, string.Empty);
                }
            }
            if (text.Length > 0)
            {
                this.hasPicture = true;
                base.Response.Write("<div id=divPic class=\"spP fltBefore\"><div class=\"fltBefore\" id=frm><a id=lnkPic target=_blank href=\"");
                Utilities.HtmlEncode(text, base.Response.Output);
                base.Response.Write("\"><IMG id=imgPic src=\"");
                Utilities.HtmlEncode(text, base.Response.Output);
                base.Response.Write("\"></a></div></div>");
            }
        }
コード例 #2
0
        // Token: 0x06002C61 RID: 11361 RVA: 0x000F7264 File Offset: 0x000F5464
        private Stream GetContactPictureStream(Item item, string attId, out string contentType)
        {
            contentType = string.Empty;
            if (item == null)
            {
                return(new MemoryStream());
            }
            if (string.IsNullOrEmpty(attId))
            {
                attId = RenderingUtilities.GetContactPictureAttachmentId(item);
            }
            if (string.IsNullOrEmpty(attId))
            {
                return(new MemoryStream());
            }
            AttachmentId         id = item.CreateAttachmentId(attId);
            AttachmentCollection attachmentCollection = Utilities.GetAttachmentCollection(item, true, base.UserContext);
            Stream result;

            using (StreamAttachment streamAttachment = attachmentCollection.Open(id) as StreamAttachment)
            {
                if (streamAttachment == null)
                {
                    throw new OwaInvalidRequestException("Attachment is not a stream attachment");
                }
                AttachmentPolicy.Level attachmentLevel = AttachmentLevelLookup.GetAttachmentLevel(streamAttachment, base.UserContext);
                if (attachmentLevel == AttachmentPolicy.Level.Block)
                {
                    result = new MemoryStream();
                }
                else
                {
                    contentType = AttachmentEventHandler.GetContentType(streamAttachment.FileName);
                    if (contentType.Length == 0)
                    {
                        ExTraceGlobals.ContactsTracer.TraceDebug <string>((long)this.GetHashCode(), "Cannot determine image type for file: {0}", streamAttachment.FileName);
                        result = new MemoryStream();
                    }
                    else
                    {
                        result = streamAttachment.GetContentStream();
                    }
                }
            }
            return(result);
        }