Пример #1
0
        // Token: 0x06000EF9 RID: 3833 RVA: 0x000739DC File Offset: 0x00071BDC
        private IProducerConsumer CreateChain(Stream input, bool push, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.locked        = true;
            this.reportBytes   = new ReportBytes(this.expansionSizeLimit, this.expansionSizeMultiple);
            output.ReportBytes = this.reportBytes;
            RtfParser parser;

            if (!this.enableHtmlDeencapsulation)
            {
                parser = new RtfParser(input, push, base.InputStreamBufferSize, this.testBoundaryConditions, push ? null : progressMonitor, this.reportBytes);
                HtmlInjection injection = null;
                if (this.injectHead != null || this.injectTail != null)
                {
                    injection = new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, this.filterHtml, this.htmlCallback, this.testBoundaryConditions, null, progressMonitor);
                }
                HtmlWriter   writer  = new HtmlWriter(output, this.filterHtml, !this.testNoNewLines);
                FormatOutput output2 = new HtmlFormatOutput(writer, injection, this.outputFragment, this.testFormatTraceStream, this.testFormatOutputTraceStream, this.filterHtml, this.htmlCallback, true);
                return(new RtfFormatConverter(parser, output2, null, false, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum, this.testFormatConverterTraceStream));
            }
            RtfPreviewStream rtfPreviewStream = input as RtfPreviewStream;

            if (!push && rtfPreviewStream != null && rtfPreviewStream.Parser != null && rtfPreviewStream.InternalPosition == 0 && rtfPreviewStream.InputRtfStream != null)
            {
                rtfPreviewStream.InternalPosition = int.MaxValue;
                parser = new RtfParser(rtfPreviewStream.InputRtfStream, base.InputStreamBufferSize, this.testBoundaryConditions, push ? null : progressMonitor, rtfPreviewStream.Parser, this.reportBytes);
                return(this.CreateChain(rtfPreviewStream.Encapsulation, parser, output, progressMonitor));
            }
            parser = new RtfParser(input, push, base.InputStreamBufferSize, this.testBoundaryConditions, push ? null : progressMonitor, this.reportBytes);
            return(new RtfToHtmlAdapter(parser, output, this, progressMonitor));
        }
Пример #2
0
        internal override FormatConverter CreatePullChain(Stream sourceStream, IProgressMonitor progressMonitor)
        {
            this.Locked      = true;
            this.reportBytes = new ReportBytes();
            RtfParser parser;

            if (this.enableHtmlDeencapsulation)
            {
                RtfPreviewStream rtfPreviewStream = sourceStream as RtfPreviewStream;
                if (rtfPreviewStream == null || rtfPreviewStream.Parser == null || rtfPreviewStream.InternalPosition != 0 || rtfPreviewStream.InputRtfStream == null)
                {
                    rtfPreviewStream = new RtfPreviewStream(sourceStream, base.InputStreamBufferSize);
                }
                parser = new RtfParser(rtfPreviewStream.InputRtfStream, base.InputStreamBufferSize, base.TestBoundaryConditions, progressMonitor, rtfPreviewStream.Parser, this.reportBytes);
                if (rtfPreviewStream.Encapsulation == RtfEncapsulation.Html)
                {
                    return(this.CreateDeencapsulationChain(parser, progressMonitor));
                }
            }
            else
            {
                parser = new RtfParser(sourceStream, false, base.InputStreamBufferSize, base.TestBoundaryConditions, progressMonitor, this.reportBytes);
            }
            FormatStore formatStore = new FormatStore();

            return(new RtfFormatConverter(parser, formatStore, false, this.TestTraceStream, this.TestTraceShowTokenNum, this.TestTraceStopOnTokenNum, this.TestFormatConverterTraceStream));
        }