Esempio n. 1
0
 public AttachmentWellInfo(AttachmentCollection collection, Attachment attachment, bool isJunkOrPhishing)
 {
     this.collection   = collection;
     this.attachmentId = attachment.Id;
     if (isJunkOrPhishing)
     {
         this.attachmentLevel = AttachmentPolicy.Level.Block;
     }
     else
     {
         this.attachmentLevel = AttachmentLevelLookup.GetAttachmentLevel(attachment, UserContextManager.GetUserContext());
     }
     this.attachmentType = attachment.AttachmentType;
     this.fileName       = attachment.FileName;
     if (this.attachmentType == AttachmentType.EmbeddedMessage)
     {
         using (Item itemAsReadOnly = ((ItemAttachment)attachment).GetItemAsReadOnly(null))
         {
             this.displayName = AttachmentUtility.GetEmbeddedAttachmentDisplayName(itemAsReadOnly);
         }
         this.fileExtension = ".msg";
     }
     else
     {
         this.displayName   = attachment.DisplayName;
         this.fileExtension = ((attachment.FileExtension == null) ? string.Empty : attachment.FileExtension);
     }
     this.isInline       = attachment.IsInline;
     this.attachmentSize = attachment.Size;
     this.attachmentName = AttachmentUtility.CalculateAttachmentName(this.displayName, this.fileName);
     this.mimeType       = AttachmentUtility.CalculateContentType(attachment);
     this.textCharset    = attachment.TextCharset;
 }
        // Token: 0x0600071F RID: 1823 RVA: 0x00037D98 File Offset: 0x00035F98
        private bool GetContentType(HttpContext httpContext, StreamAttachmentBase streamAttachment, AttachmentPolicy.Level level, out string contentType)
        {
            contentType = AttachmentUtility.CalculateContentType(streamAttachment);
            bool flag = AttachmentUtility.DoNeedToFilterHtml(contentType, streamAttachment.FileExtension, level, OwaContext.Get(httpContext).UserContext);

            if (string.IsNullOrEmpty(contentType) && this.IsVoiceMailAttachment(httpContext))
            {
                contentType = "audio/x-ms-wma";
            }
            else if (flag)
            {
                AttachmentUtility.UpdateContentTypeForNeedToFilter(out contentType, streamAttachment.TextCharset);
            }
            return(flag);
        }