示例#1
0
        private void InitializeAndLock()
        {
            this.locked = true;
            ConverterInput converterInput;

            if (this.input is Stream)
            {
                if (this.inputEncoding == null)
                {
                    throw new InvalidOperationException(TextConvertersStrings.InputEncodingRequired);
                }
                converterInput = new ConverterDecodingInput((Stream)this.input, false, this.inputEncoding, this.detectEncodingFromByteOrderMark, TextConvertersDefaults.MaxTokenSize(this.testBoundaryConditions), TextConvertersDefaults.MaxHtmlMetaRestartOffset(this.testBoundaryConditions), 16384, this.testBoundaryConditions, this, null);
            }
            else
            {
                converterInput = new ConverterUnicodeInput(this.input, false, TextConvertersDefaults.MaxTokenSize(this.testBoundaryConditions), this.testBoundaryConditions, null);
            }
            HtmlParser htmlParser = new HtmlParser(converterInput, false, false, TextConvertersDefaults.MaxTokenRuns(this.testBoundaryConditions), TextConvertersDefaults.MaxHtmlAttributes(this.testBoundaryConditions), this.testBoundaryConditions);

            if (this.normalizeInputHtml)
            {
                this.parser = new HtmlNormalizingParser(htmlParser, null, false, TextConvertersDefaults.MaxHtmlNormalizerNesting(this.testBoundaryConditions), this.testBoundaryConditions, this.testNormalizerTraceStream, this.testNormalizerTraceShowTokenNum, this.testNormalizerTraceStopOnTokenNum);
                return;
            }
            this.parser = htmlParser;
        }
示例#2
0
 internal HtmlToHtmlSafe SetTestBoundaryConditions(bool value)
 {
     base.AssertNotLocked();
     this.testBoundaryConditions = value;
     this.maxTokenSize           = (value ? TextConvertersDefaults.MaxTokenSize(value) : 32768);
     return(this);
 }