// Token: 0x06000716 RID: 1814 RVA: 0x000377E8 File Offset: 0x000359E8
        internal static int SendDocumentContentToHttpStream(HttpContext httpContext, Stream stream, string fileName, string fileExtension, string contentType)
        {
            if (httpContext == null)
            {
                throw new ArgumentNullException("httpContext");
            }
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            if (string.IsNullOrEmpty(fileName))
            {
                fileName = LocalizedStrings.GetNonEncoded(1797976510);
            }
            if (fileExtension == null)
            {
                fileExtension = string.Empty;
            }
            if (contentType == null)
            {
                contentType = string.Empty;
            }
            bool flag = AttachmentUtility.DoNeedToFilterHtml(contentType, fileExtension, AttachmentPolicy.Level.Unknown, OwaContext.Get(httpContext).UserContext);

            if (flag)
            {
                AttachmentUtility.UpdateContentTypeForNeedToFilter(out contentType, null);
            }
            return(AttachmentHandler.SendDocumentContentToHttpStream(httpContext, stream, fileName, fileExtension, contentType, false, null, BlockStatus.DontKnow, AttachmentPolicy.Level.Unknown, flag));
        }
        // Token: 0x0600071C RID: 1820 RVA: 0x00037B9C File Offset: 0x00035D9C
        private void ProcessAttachment(Attachment attachment, HttpContext httpContext, BlockStatus blockStatus)
        {
            if (attachment == null)
            {
                throw new ArgumentNullException("attachment");
            }
            OwaContext  owaContext  = OwaContext.Get(httpContext);
            UserContext userContext = owaContext.UserContext;
            Stream      stream      = null;

            try
            {
                StreamAttachmentBase streamAttachment = AttachmentUtility.GetStreamAttachment(attachment);
                if (streamAttachment == null)
                {
                    ExTraceGlobals.AttachmentHandlingTracer.TraceError((long)this.GetHashCode(), "AttachmentHandler.ProcessAttachment: attachment is not derived from AttachmentStream");
                }
                else
                {
                    AttachmentPolicy.Level attachmentLevel = AttachmentLevelLookup.GetAttachmentLevel(streamAttachment, userContext);
                    if (attachmentLevel == AttachmentPolicy.Level.Block)
                    {
                        Utilities.TransferToErrorPage(owaContext, LocalizedStrings.GetNonEncoded(-2000404449), LocalizedStrings.GetNonEncoded(-615885395));
                    }
                    else
                    {
                        string fileName = AttachmentUtility.CalculateAttachmentName(streamAttachment.DisplayName, streamAttachment.FileName);
                        string text     = streamAttachment.FileExtension;
                        if (text == null)
                        {
                            text = string.Empty;
                        }
                        string empty       = string.Empty;
                        bool   contentType = this.GetContentType(httpContext, streamAttachment, attachmentLevel, out empty);
                        bool   isInline    = this.GetIsInline(streamAttachment, attachmentLevel);
                        stream = AttachmentUtility.GetStream(streamAttachment);
                        if (stream == null)
                        {
                            ExTraceGlobals.AttachmentHandlingTracer.TraceError((long)this.GetHashCode(), "AttachmentHandler.ProcessAttachment: Image conversion of OLE attachment failure");
                        }
                        else
                        {
                            AttachmentHandler.SendDocumentContentToHttpStream(httpContext, stream, fileName, text, empty, isInline, streamAttachment.TextCharset, blockStatus, attachmentLevel, contentType);
                        }
                    }
                }
            }
            finally
            {
                if (stream != null)
                {
                    stream.Dispose();
                }
            }
        }
        // Token: 0x06000717 RID: 1815 RVA: 0x0003786C File Offset: 0x00035A6C
        private static int SendDocumentContentToHttpStream(HttpContext httpContext, Stream stream, string fileName, string fileExtension, string contentType, bool isInline, Charset charset, BlockStatus blockStatus, AttachmentPolicy.Level level, bool doNeedToFilterHtml)
        {
            if (AttachmentUtility.IsMhtmlAttachment(contentType, fileExtension))
            {
                ExTraceGlobals.AttachmentHandlingTracer.TraceDebug <string>(0L, "AttachmentHandler.SendDocumentContentToHttpStream: Explicitly blocking MHTML attachment {0}", fileName);
                return(0);
            }
            AttachmentHandler.SetAttachmentResponseHeaders(httpContext, fileName, contentType, isInline, level);
            uint result;

            if (doNeedToFilterHtml)
            {
                result = AttachmentUtility.WriteFilteredResponse(httpContext, stream, charset, blockStatus);
            }
            else
            {
                bool isNotHtmlandNotXml = !AttachmentUtility.GetIsHtmlOrXml(contentType, fileExtension);
                bool doNotSniff         = AttachmentUtility.GetDoNotSniff(level, OwaContext.Get(httpContext).UserContext);
                result = AttachmentUtility.WriteUnfilteredResponse(httpContext, stream, fileName, isNotHtmlandNotXml, doNotSniff);
            }
            return((int)result);
        }