/// <summary> /// Initializes a new instance of the <see cref="InProcessRenderer" /> class. /// </summary> /// <param name="browser">The browser</param> /// <param name="domModifications">The dom modifications to apply</param> /// <param name="minRenderTime">The minimum render time in seconds (default: 10s)</param> /// <param name="maxRenderTime">The maximum render time in seconds (default: 60s)</param> /// <param name="validateSerializationResult">Whether to validate the serialization result</param> /// <param name="spinWait">The spin wait to use</param> public InProcessRenderer(WebBrowser browser, IEnumerable <IDomModification> domModifications, double minRenderTime, double maxRenderTime, bool validateSerializationResult, SpinWait spinWait) : base(browser.DefaultStyles) { _browser = browser; _domModifications = domModifications; _minRenderTime = minRenderTime * 1000; _maxRenderTime = maxRenderTime * 1000; _domSerializer = new HtmlDocumentSerializer(browser.DefaultStyles); _spinWait = spinWait; _spinWait.OnSpin = () => _browser.DoEvents(); _spinWait.Condition = this.RenderingFinished; _domModificationsApplied = false; }
/// <summary> /// Initializes a new instance of the <see cref="AppServices"/> class /// </summary> public AppServices() { var defaultStyleLookup = DefaultStyleLookup.CreateForInternetExplorer(); bool validateSerializationResult = false; _htmlDocumentSerializer = new HtmlDocumentSerializer(defaultStyleLookup, validateSerializationResult); _zoneTreeSerializer = new ZoneTreeSerializer(defaultStyleLookup); _elementClassifier = new PreZoningClassification(HtmlElementType.SignificantBlock, HtmlElementType.SignificantInline, HtmlElementType.SignificantLinebreak, HtmlElementType.SignificantInvisible, HtmlElementType.BreakDown, HtmlElementType.Aname, HtmlElementType.Hidden); _zoneTreeBuilder = ZoneTreeBuilder.Create(HtmlElementType.SignificantBlock, HtmlElementType.SignificantInline, HtmlElementType.SignificantLinebreak, HtmlElementType.SignificantInvisible, HtmlElementType.BreakDown, HtmlElementType.Aname, HtmlElementType.Hidden); _columnTreeBuilder = ColumnTreeBuilder.Create(); var naturalLanguageProcessor = new OpenNaturalLanguageProcessor(); _layoutAnalysisArticleContentLabeler = new ArticleContentLabeler(naturalLanguageProcessor, ZoneLabel.Paragraph, ZoneLabel.ArticleContent, ZoneFeature.Common_Tokens); _articleTagArticleContentLabeler = new SemanticTagArticleContentLabeler(Html.Tags.ARTICLE, ZoneLabel.ArticleContent); _mainTagArticleContentLabeler = new SemanticTagArticleContentLabeler(Html.Tags.MAIN, ZoneLabel.ArticleContent); }
public AppServices(Configuration config) { _config = config; _documentSerializer = new HtmlDocumentSerializer(); _zoneTreeSerializer = new ZoneTreeSerializer(); }