Ejemplo n.º 1
0
        private char[] LoadCachedBodyData(out MemoryStream htmlBody)
        {
            htmlBody = null;
            if (!this.coreItem.Body.IsBodyDefined)
            {
                return(null);
            }
            BodyReadConfiguration configuration = new BodyReadConfiguration(BodyFormat.TextPlain);

            if (this.coreItem.Body.RawFormat == BodyFormat.TextHtml)
            {
                htmlBody          = this.LoadHtmlBodyInMemory();
                htmlBody.Position = 0L;
                using (TextReader textReader = new BodyTextReader(this.coreItem, configuration, new StreamWrapper(htmlBody, false)))
                {
                    return(Util.StreamHandler.ReadCharBuffer(textReader, 16384));
                }
            }
            char[] result;
            using (TextReader textReader2 = new BodyTextReader(this.coreItem, configuration, null))
            {
                result = Util.StreamHandler.ReadCharBuffer(textReader2, 16384);
            }
            return(result);
        }
Ejemplo n.º 2
0
        public TextReader OpenTextReader(BodyReadConfiguration configuration)
        {
            Body.CheckNull(configuration, "configuration");
            this.CheckStreamingExceptions();
            TextReader result;

            lock (this.bodyStreamsLock)
            {
                this.CheckOpenBodyStreamForRead();
                BodyTextReader bodyTextReader = new BodyTextReader(this.coreItem, configuration, null);
                this.bodyReadStreams.Add(bodyTextReader);
                result = bodyTextReader;
            }
            return(result);
        }