// 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
        private IProducerConsumer CreateChain(ConverterInput input, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.locked = true;
            HtmlParser htmlParser = new HtmlParser(input, this.detectEncodingFromMetaTag, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, this.testBoundaryConditions);

            if (this.mode == TextExtractionMode.ExtractText)
            {
                return(new HtmlTextExtractionConverter(htmlParser, output, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum));
            }
            Injection injection = null;

            if (this.injectHead != null || this.injectTail != null)
            {
                injection = ((this.injectionFormat == HeaderFooterFormat.Html) ? new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, false, null, this.testBoundaryConditions, null, progressMonitor) : new TextInjection(this.injectHead, this.injectTail, this.testBoundaryConditions, null, progressMonitor));
            }
            IHtmlParser parser = htmlParser;

            if (this.normalizeInputHtml)
            {
                if (this.injectionFormat == HeaderFooterFormat.Html)
                {
                    parser    = new HtmlNormalizingParser(htmlParser, (HtmlInjection)injection, false, this.testMaxHtmlNormalizerNesting, this.testBoundaryConditions, this.testNormalizerTraceStream, this.testNormalizerTraceShowTokenNum, this.testNormalizerTraceStopOnTokenNum);
                    injection = null;
                }
                else
                {
                    parser = new HtmlNormalizingParser(htmlParser, null, false, this.testMaxHtmlNormalizerNesting, this.testBoundaryConditions, this.testNormalizerTraceStream, this.testNormalizerTraceShowTokenNum, this.testNormalizerTraceStopOnTokenNum);
                }
            }
            TextOutput output2 = new TextOutput(output, this.wrapFlowed, this.wrapFlowed, 72, 78, this.imageRenderingCallback, this.fallbacks, this.htmlEscape, this.testPreserveTrailingSpaces, this.testFormatTraceStream);

            return(new HtmlToTextConverter(parser, output2, injection, false, false, this.testTreatNbspAsBreakable, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum, this.ShouldUseNarrowGapForPTagHtmlToTextConversion, this.OutputAnchorLinks, this.OutputImageLinks));
        }
示例#3
0
        private IProducerConsumer CreateChain(ConverterInput input, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.locked = true;
            Injection      injection = null;
            EnrichedParser parser    = new EnrichedParser(input, this.testMaxTokenRuns, this.testBoundaryConditions);

            if (this.injectHead != null || this.injectTail != null)
            {
                injection = ((this.injectionFormat == HeaderFooterFormat.Html) ? new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, false, null, this.testBoundaryConditions, null, progressMonitor) : new TextInjection(this.injectHead, this.injectTail, this.testBoundaryConditions, null, progressMonitor));
            }
            TextOutput output2 = new TextOutput(output, this.wrapFlowed, this.wrapFlowed, 72, 78, null, this.fallbacks, this.htmlEscape, this.testPreserveTrailingSpaces, this.testFormatTraceStream);

            return(new EnrichedToTextConverter(parser, output2, injection, this.testTreatNbspAsBreakable, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum));
        }
示例#4
0
        // Token: 0x06000FAE RID: 4014 RVA: 0x0007539C File Offset: 0x0007359C
        private IProducerConsumer CreateChain(ConverterInput input, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.locked = true;
            HtmlInjection injection = null;
            HtmlParser    parser    = new HtmlParser(input, this.detectEncodingFromMetaTag, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, this.testBoundaryConditions);

            if (this.injectHead != null || this.injectTail != null)
            {
                injection = new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, false, null, this.testBoundaryConditions, null, progressMonitor);
            }
            HtmlNormalizingParser parser2 = new HtmlNormalizingParser(parser, injection, false, this.testMaxHtmlNormalizerNesting, this.testBoundaryConditions, this.testNormalizerTraceStream, this.testNormalizerTraceShowTokenNum, this.testNormalizerTraceStopOnTokenNum);
            EnrichedFormatOutput  output2 = new EnrichedFormatOutput(output, null, this.fallbacks, this.testFormatTraceStream, this.testFormatOutputTraceStream);

            return(new HtmlFormatConverter(parser2, output2, false, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum, this.testFormatConverterTraceStream, progressMonitor));
        }
示例#5
0
        private IProducerConsumer CreateChain(ConverterInput input, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.locked = true;
            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);
            }
            TextParser   parser  = new TextParser(input, this.unwrapFlowed, this.unwrapDelSp, this.testMaxTokenRuns, this.testBoundaryConditions);
            HtmlWriter   writer  = new HtmlWriter(output, this.filterHtml, false);
            FormatOutput output2 = new HtmlFormatOutput(writer, injection, this.outputFragment, this.testFormatTraceStream, this.testFormatOutputTraceStream, this.filterHtml, this.htmlCallback, true);

            return(new TextFormatConverter(parser, output2, null, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum, this.testFormatConverterTraceStream));
        }
示例#6
0
        private IProducerConsumer CreateChain(ConverterInput input, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.locked = true;
            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);
            }
            HtmlParser            parser  = new HtmlParser(input, this.detectEncodingFromMetaTag, false, TextConvertersDefaults.MaxTokenRuns(this.testBoundaryConditions), TextConvertersDefaults.MaxHtmlAttributes(this.testBoundaryConditions), this.testBoundaryConditions);
            HtmlNormalizingParser parser2 = new HtmlNormalizingParser(parser, injection, false, TextConvertersDefaults.MaxHtmlNormalizerNesting(this.testBoundaryConditions), this.testBoundaryConditions, this.testNormalizerTraceStream, this.testNormalizerTraceShowTokenNum, this.testNormalizerTraceStopOnTokenNum);
            HtmlWriter            writer  = new HtmlWriter(output, this.filterHtml, true);
            FormatOutput          output2 = new HtmlFormatOutput(writer, null, this.OutputFragment, this.TestFormatTraceStream, this.TestFormatOutputTraceStream, this.filterHtml, this.htmlCallback, false);

            return(new HtmlFormatConverter(parser2, output2, false, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum, this.TestFormatConverterTraceStream, progressMonitor));
        }
示例#7
0
        private IProducerConsumer CreateChain(ConverterInput input, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.locked = true;
            HtmlInjection     htmlInjection  = null;
            HtmlInjection     htmlInjection2 = null;
            IProducerConsumer result;

            try
            {
                if (this.injectHead != null || this.injectTail != null)
                {
                    htmlInjection2          = new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, this.filterHtml, this.htmlCallback, this.testBoundaryConditions, null, progressMonitor);
                    htmlInjection           = htmlInjection2;
                    this.normalizeInputHtml = true;
                }
                if (this.filterHtml || this.outputFragment || this.htmlCallback != null)
                {
                    this.normalizeInputHtml = true;
                }
                IHtmlParser parser2;
                if (this.normalizeInputHtml)
                {
                    HtmlParser parser = new HtmlParser(input, this.detectEncodingFromMetaTag, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, this.testBoundaryConditions);
                    parser2        = new HtmlNormalizingParser(parser, htmlInjection, this.htmlCallback != null, this.testMaxHtmlNormalizerNesting, this.testBoundaryConditions, this.testNormalizerTraceStream, this.testNormalizerTraceShowTokenNum, this.testNormalizerTraceStopOnTokenNum);
                    htmlInjection2 = null;
                }
                else
                {
                    parser2 = new HtmlParser(input, this.detectEncodingFromMetaTag, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, this.testBoundaryConditions);
                }
                HtmlWriter writer = new HtmlWriter(output, this.filterHtml, this.normalizeInputHtml && !this.testNoNewLines);
                result = new HtmlToHtmlConverter(parser2, writer, this.testConvertFragment, this.outputFragment, this.filterHtml, this.htmlCallback, this.testTruncateForCallback, htmlInjection != null && htmlInjection.HaveTail, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum, this.smallCssBlockThreshold, this.preserveDisplayNoneStyle, progressMonitor);
            }
            finally
            {
                IDisposable disposable = htmlInjection2;
                if (disposable != null)
                {
                    disposable.Dispose();
                    htmlInjection2 = null;
                }
            }
            return(result);
        }
示例#8
0
        private IProducerConsumer CreateChain(Stream input, bool push, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.locked = true;
            RtfParser parser = new RtfParser(input, push, base.InputStreamBufferSize, this.testBoundaryConditions, push ? null : progressMonitor, null);

            if (this.textExtractionMode == TextExtractionMode.ExtractText)
            {
                return(new RtfTextExtractionConverter(parser, output, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum));
            }
            Injection injection = null;

            if (this.injectHead != null || this.injectTail != null)
            {
                injection = ((this.injectionFormat == HeaderFooterFormat.Html) ? new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, false, null, this.testBoundaryConditions, null, progressMonitor) : new TextInjection(this.injectHead, this.injectTail, this.testBoundaryConditions, null, progressMonitor));
            }
            TextOutput output2 = new TextOutput(output, this.wrapFlowed, this.wrapFlowed, 72, 78, null, this.fallbacks, this.htmlEscape, this.testPreserveTrailingSpaces, this.testFormatTraceStream);

            return(new RtfToTextConverter(parser, output2, injection, this.testTreatNbspAsBreakable, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum));
        }
示例#9
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (this.output != null)
                {
                    if (!this.copyPending)
                    {
                        this.Flush();
                    }

                    if (this.output is IDisposable disposable)
                    {
                        disposable.Dispose();
                    }
                }

                GC.SuppressFinalize(this);
            }

            this.output = null;
        }
示例#10
0
        // Token: 0x06000EFA RID: 3834 RVA: 0x00073B80 File Offset: 0x00071D80
        internal IProducerConsumer CreateChain(RtfEncapsulation encapsulation, RtfParser parser, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.rtfEncapsulation = encapsulation;
            if (this.reportBytes == null)
            {
                throw new InvalidOperationException("I have an RtfParser but no ReportBytes.");
            }
            output.ReportBytes = this.reportBytes;
            IProducerConsumer result;

            if (encapsulation != RtfEncapsulation.Html)
            {
                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);
                RtfFormatConverter rtfFormatConverter = new RtfFormatConverter(parser, output2, null, false, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum, this.testFormatConverterTraceStream);
                result = rtfFormatConverter;
            }
            else
            {
                HtmlInjection htmlInjection  = null;
                HtmlInjection htmlInjection2 = null;
                try
                {
                    if (this.injectHead != null || this.injectTail != null)
                    {
                        htmlInjection2          = new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, this.filterHtml, this.htmlCallback, this.testBoundaryConditions, null, progressMonitor);
                        htmlInjection           = htmlInjection2;
                        this.normalizeInputHtml = true;
                    }
                    if (this.filterHtml || this.outputFragment || this.htmlCallback != null)
                    {
                        this.normalizeInputHtml = true;
                    }
                    HtmlInRtfExtractingInput input = new HtmlInRtfExtractingInput(parser, this.maxHtmlTagSize, this.testBoundaryConditions, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum);
                    IHtmlParser parser3;
                    if (this.normalizeInputHtml)
                    {
                        HtmlParser parser2 = new HtmlParser(input, false, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, this.testBoundaryConditions);
                        parser3        = new HtmlNormalizingParser(parser2, htmlInjection, this.htmlCallback != null, this.testMaxHtmlNormalizerNesting, this.testBoundaryConditions, this.testNormalizerTraceStream, this.testNormalizerTraceShowTokenNum, this.testNormalizerTraceStopOnTokenNum);
                        htmlInjection2 = null;
                    }
                    else
                    {
                        parser3 = new HtmlParser(input, false, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, this.testBoundaryConditions);
                    }
                    HtmlWriter writer2 = new HtmlWriter(output, this.filterHtml, this.normalizeInputHtml && !this.testNoNewLines);
                    result = new HtmlToHtmlConverter(parser3, writer2, false, this.outputFragment, this.filterHtml, this.htmlCallback, this.testTruncateForCallback, htmlInjection != null && htmlInjection.HaveTail, this.testHtmlTraceStream, this.testHtmlTraceShowTokenNum, this.testHtmlTraceStopOnTokenNum, this.smallCssBlockThreshold, this.preserveDisplayNoneStyle, progressMonitor);
                }
                finally
                {
                    IDisposable disposable = htmlInjection2;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                        htmlInjection2 = null;
                    }
                }
            }
            return(result);
        }
示例#11
0
        private IProducerConsumer CreateChain(ConverterInput input, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.Locked = true;

            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);

                this.normalizeInputHtml = true;
            }

            if (this.filterHtml || this.outputFragment || this.htmlCallback != null)
            {
                this.normalizeInputHtml = true;
            }

            IHtmlParser parser;

            if (this.normalizeInputHtml)
            {
                HtmlParser preParser = new HtmlParser(
                    input,
                    this.detectEncodingFromMetaTag,
                    false,
                    this.testMaxTokenRuns,
                    this.testMaxHtmlTagAttributes,
                    this.TestBoundaryConditions);

                parser = new HtmlNormalizingParser(
                    preParser,
                    injection,
                    this.htmlCallback != null,
                    this.testMaxHtmlNormalizerNesting,
                    this.TestBoundaryConditions,
                    this.testNormalizerTraceStream,
                    this.testNormalizerTraceShowTokenNum,
                    this.testNormalizerTraceStopOnTokenNum);
            }
            else
            {
                parser = new HtmlParser(
                    input,
                    this.detectEncodingFromMetaTag,
                    false,
                    this.testMaxTokenRuns,
                    this.testMaxHtmlTagAttributes,
                    this.TestBoundaryConditions);
            }

            HtmlWriter writer = new HtmlWriter(
                output,
                this.filterHtml,
                this.normalizeInputHtml);

            return(new HtmlToHtmlConverter(
                       parser,
                       writer,
                       false,
                       this.outputFragment,
                       this.filterHtml,
                       this.htmlCallback,
                       this.testTruncateForCallback,
                       injection != null && injection.HaveTail,
                       this.testTraceStream,
                       this.testTraceShowTokenNum,
                       this.testTraceStopOnTokenNum,
                       this.smallCssBlockThreshold,
                       this.preserveDisplayNoneStyle,
                       progressMonitor));
        }
示例#12
0
 internal HtmlWriter(ConverterOutput output, bool filterHtml, bool autoNewLines)
 {
     this.output       = output;
     this.filterHtml   = filterHtml;
     this.autoNewLines = autoNewLines;
 }