// Token: 0x06000620 RID: 1568 RVA: 0x00030A78 File Offset: 0x0002EC78
        public static void RenderReadBody(TextWriter output, Item item, OwaSafeHtmlCallbackBase callBack, bool isJunkOrPhishing)
        {
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }
            if (item == null)
            {
                return;
            }
            ReportMessage reportMessage = item as ReportMessage;
            bool          flag          = null != reportMessage;

            if (Utilities.IsOpaqueSigned(item))
            {
                MessageItem messageItem = item as MessageItem;
                Item        item2       = null;
                if (messageItem != null && ItemConversion.TryOpenSMimeContent(messageItem, OwaContext.Current.UserContext.Configuration.DefaultAcceptedDomain.Name, out item2))
                {
                    item = item2;
                }
            }
            if (item.Body == null || (flag && item.Body.Size <= 0L))
            {
                if (flag)
                {
                    using (MemoryStream memoryStream = new MemoryStream())
                    {
                        Charset charset;
                        reportMessage.GenerateReportBody(memoryStream, out charset);
                        item.OpenAsReadWrite();
                        BodyWriteConfiguration configuration = new BodyWriteConfiguration(BodyFormat.TextHtml, charset.Name);
                        using (Stream stream = item.Body.OpenWriteStream(configuration))
                        {
                            memoryStream.Position = 0L;
                            memoryStream.WriteTo(stream);
                        }
                        goto IL_DC;
                    }
                }
                return;
            }
IL_DC:
            Body body = item.Body;

            if (!OwaContext.Current.UserContext.IsBasicExperience && OwaContext.Current.UserContext.IsIrmEnabled && Utilities.IsIrmRestrictedAndDecrypted(item))
            {
                body = ((RightsManagedMessageItem)item).ProtectedBody;
            }
            if (body.Size > 0L)
            {
                Markup markup = Markup.Html;
                if (isJunkOrPhishing)
                {
                    markup = Markup.PlainText;
                }
                BodyConversionUtilities.ConvertAndOutputBody(output, body, markup, callBack, false);
            }
        }
        // Token: 0x06002FC4 RID: 12228 RVA: 0x00115FB0 File Offset: 0x001141B0
        private static void RenderComposeBody(TextWriter output, Item item, OwaSafeHtmlCallbackBase callBack, UserContext userContext, Markup markup)
        {
            if (item == null)
            {
                return;
            }
            Body body = item.Body;

            if (OwaContext.Current.UserContext.IsIrmEnabled && Utilities.IsIrmRestrictedAndDecrypted(item))
            {
                body = ((RightsManagedMessageItem)item).ProtectedBody;
            }
            if (body != null && body.Size > 0L)
            {
                BodyConversionUtilities.ConvertAndOutputBody(output, body, markup, callBack);
            }
        }
        // Token: 0x06000622 RID: 1570 RVA: 0x00030C24 File Offset: 0x0002EE24
        public static void ConvertAndOutputBody(TextWriter output, Body body, Markup markup, OwaSafeHtmlCallbackBase callBack, bool isComposeBody)
        {
            string bodyString = string.Empty;
            BodyReadConfiguration bodyReadConfiguration = null;

            try
            {
                switch (markup)
                {
                case Markup.Html:
                    bodyReadConfiguration = new BodyReadConfiguration(BodyFormat.TextHtml);
                    bodyReadConfiguration.SetHtmlOptions(HtmlStreamingFlags.FilterHtml | HtmlStreamingFlags.Fragment, callBack);
                    break;

                case Markup.PlainText:
                    bodyReadConfiguration = new BodyReadConfiguration(BodyFormat.TextPlain);
                    break;
                }
                if (bodyReadConfiguration != null)
                {
                    using (TextReader textReader = body.OpenTextReader(bodyReadConfiguration))
                    {
                        bodyString = textReader.ReadToEnd();
                    }
                }
                BodyConversionUtilities.RenderBodyContent(output, bodyString, markup, isComposeBody);
            }
            catch (InvalidCharsetException innerException)
            {
                throw new OwaBodyConversionFailedException("Body Conversion Failed", innerException);
            }
            catch (ConversionFailedException innerException2)
            {
                throw new OwaBodyConversionFailedException("Body Conversion Failed", innerException2);
            }
        }
        // Token: 0x06002FC1 RID: 12225 RVA: 0x00115CE8 File Offset: 0x00113EE8
        internal static void ConvertAndOutputBody(TextWriter output, Body body, Markup markup, OwaSafeHtmlCallbackBase callBack)
        {
            try
            {
                BodyReadConfiguration bodyReadConfiguration = null;
                switch (markup)
                {
                case Markup.Html:
                    bodyReadConfiguration = new BodyReadConfiguration(BodyFormat.TextHtml, "utf-8");
                    bodyReadConfiguration.SetHtmlOptions(HtmlStreamingFlags.FilterHtml, callBack);
                    break;

                case Markup.PlainText:
                    bodyReadConfiguration = new BodyReadConfiguration(BodyFormat.TextPlain, "utf-8");
                    break;
                }
                if (bodyReadConfiguration != null)
                {
                    using (TextReader textReader = body.OpenTextReader(bodyReadConfiguration))
                    {
                        BodyConversionUtilities.HtmlEncodeAndOutputBody(output, textReader);
                    }
                }
            }
            catch (InvalidCharsetException innerException)
            {
                throw new OwaBodyConversionFailedException("Body Conversion Failed", innerException);
            }
            catch (ConversionFailedException innerException2)
            {
                throw new OwaBodyConversionFailedException("Body Conversion Failed", innerException2);
            }
        }