Esempio n. 1
0
        /// <summary>
        /// Renders an HTML node to a file.
        /// </summary>
        public static void SaveNode(this IHtmlRenderer renderer, HtmlNode node, string filePath)
        {
            renderer.GuardNotNull(nameof(renderer));
            node.GuardNotNull(nameof(node));
            filePath.GuardNotNull(nameof(filePath));

            using (var writer = File.CreateText(filePath))
                renderer.SaveNode(node, writer);
        }
Esempio n. 2
0
        /// <summary>
        /// Renders an HTML node to <see cref="TextWriter"/>.
        /// </summary>
        public static void SaveNode(this IHtmlRenderer renderer, HtmlNode node, TextWriter writer)
        {
            renderer.GuardNotNull(nameof(renderer));
            node.GuardNotNull(nameof(node));
            writer.GuardNotNull(nameof(writer));

            var source = renderer.RenderNode(node);

            writer.Write(source);
        }