1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-31 07:26:09 +00:00
This commit is contained in:
Yan Maniez 2019-06-15 01:37:00 +02:00
parent 921baf66cb
commit 5b3251ab59

View file

@ -380,12 +380,15 @@ namespace AideDeJeuCmd
} }
static async Task ExtractHtmlAsync() static async Task ExtractHtmlAsync()
{
for (int i = 1; i <= 434; i++)
{ {
var parser = new HtmlParser(); var parser = new HtmlParser();
var doc = new HtmlAgilityPack.HtmlDocument(); var doc = new HtmlAgilityPack.HtmlDocument();
doc.Load(@"..\..\..\..\..\Ignore\tome_of_beasts\page30.html"); doc.Load($@"..\..\..\..\..\Ignore\tome_of_beasts\page{i}.html");
parser.OutputMarkdown(parser.Parse(doc)); parser.OutputMarkdown(parser.Parse(doc));
} }
}
class HtmlParser class HtmlParser
{ {
@ -425,6 +428,8 @@ namespace AideDeJeuCmd
var txtDivs = doc.DocumentNode.SelectNodes("//div[@class='txt']"); var txtDivs = doc.DocumentNode.SelectNodes("//div[@class='txt']");
var fullText = new FullText(); var fullText = new FullText();
var fullLine = new FullLine(); var fullLine = new FullLine();
if (txtDivs != null)
{
foreach (var txtDiv in txtDivs) foreach (var txtDiv in txtDivs)
{ {
var spans = txtDiv.Elements("span"); var spans = txtDiv.Elements("span");
@ -469,6 +474,7 @@ namespace AideDeJeuCmd
} }
} }
fullText.Add(fullLine); fullText.Add(fullLine);
}
return fullText; return fullText;
} }
@ -509,17 +515,19 @@ namespace AideDeJeuCmd
} }
else if (keySpan.IdStyle.Contains("font-family:sans-serif; font-weight:normal; font-style:normal;")) else if (keySpan.IdStyle.Contains("font-family:sans-serif; font-weight:normal; font-style:normal;"))
{ {
Console.Write($"{keySpan.Text} {value}"); Console.ForegroundColor = ConsoleColor.Red;
Console.Write($"{keySpan.Text}");
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine($" {value}");
} }
else else
{ {
//Console.Write($"{spanStyle} => {span.InnerText} "); Console.ForegroundColor = ConsoleColor.Red;
Console.Write($"{keySpan.Text} {value}"); Console.Write($"{keySpan.Text}");
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine($" {value}");
} }
//Console.Write(spa.Text);
} }
Console.WriteLine();
//Console.WriteLine();
} }
} }