Ejemplo n.º 1
0
        /// <summary>
        /// Creates an instance with the default configuration
        /// </summary>
        /// <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 (default: false)</param>
        /// <param name="browser">The browser (default: Internet Explorer)</param>
        /// <param name="domModifications">The dom modifications to apply (default: see below)</param>
        /// <returns>
        /// the instance with the default configuration
        /// </returns>
        public static InProcessRenderer Create(double minRenderTime = 20, double maxRenderTime = 60, bool validateSerializationResult = false, WebBrowser browser = null, IEnumerable <IDomModification> domModifications = null)
        {
            if (domModifications == null)
            {
                domModifications = new IDomModification[]
                {
                    new RemoveOrphanElements(),
                    new RemoveUnknownElements(),
                    new RemoveCommentElements(),
                    new RemoveEmptyFreeTextNodes(),
                    new ReplaceFreeTextNodes(),
                    new ReplacePreservedWhitespace(),
                    new ReplaceFreeTextNodes(),
                };
            }

            if (browser == null)
            {
                browser = new InternetExplorer();
            }

            var spinWait = new SpinWait(SPIN_INTERVAL);

            return(new InProcessRenderer(browser, domModifications, minRenderTime, maxRenderTime, validateSerializationResult, spinWait));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Modifies the DOM
 /// </summary>
 /// <param name="modification">The modification to apply</param>
 public abstract void ModifyDom(IDomModification modification);
Ejemplo n.º 3
0
 /// <summary>
 /// Modifies the DOM
 /// </summary>
 /// <param name="modification">The modification to apply</param>
 public override void ModifyDom(IDomModification modification)
 {
     modification.Apply(this.MsHtmlDoc);
 }