mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Add ToHtmlPretty for AngleSharp
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
using System;
|
||||
using AngleSharp.Dom;
|
||||
using AngleSharp.Html;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Security.Cryptography;
|
||||
@@ -76,6 +79,20 @@ namespace Jackett.Utils
|
||||
return string.Join("&", collection.AllKeys.Select(a => a + "=" + HttpUtility.UrlEncode(collection[a], encoding)));
|
||||
}
|
||||
|
||||
public static string ToHtmlPretty(this IElement element)
|
||||
{
|
||||
if (element == null)
|
||||
return "<NULL>";
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringWriter sw = new StringWriter(sb);
|
||||
var formatter = new PrettyMarkupFormatter();
|
||||
element.ToHtml(sw, formatter);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static string GenerateRandom(int length)
|
||||
{
|
||||
var chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
Reference in New Issue
Block a user