1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-11-04 09:10:47 +00:00

Correctif xpath @class

This commit is contained in:
Yan Maniez 2018-04-29 13:58:23 +02:00
parent a75eaa90ef
commit fc19a60f70
2 changed files with 6 additions and 6 deletions

View file

@ -5,7 +5,7 @@
Title="{Binding Title}"> Title="{Binding Title}">
<ScrollView> <ScrollView>
<StackLayout Orientation="Vertical" Padding="15"> <StackLayout Orientation="Vertical" Padding="15">
<Label Text="{Binding Item.Title}" Style="{StaticResource Key=subsubsection}" /> <Label Text="{Binding Item.Name}" Style="{StaticResource Key=subsubsection}" />
<Label Text=" " /> <Label Text=" " />

View file

@ -36,19 +36,19 @@ namespace AideDeJeuLib.Monsters
public static Monster FromHtml(HtmlNode nodeMonster) public static Monster FromHtml(HtmlNode divBloc)
{ {
var monster = new Monster(); var monster = new Monster();
var divMonster = nodeMonster.SelectSingleNode("div[@class='monstre']"); var divMonster = divBloc.SelectSingleNode("div[contains(@class,'monstre')]");
monster.Name = divMonster.SelectSingleNode("h1").InnerText; monster.Name = divMonster.SelectSingleNode("h1").InnerText;
monster.NameVO = divMonster.SelectSingleNode("div[@class='trad']/a").InnerText; monster.NameVO = divMonster.SelectSingleNode("div[contains(@class,'trad')]/a").InnerText;
var divSansSerif = divMonster.SelectSingleNode("div[@class='sansSerif']"); var divSansSerif = divMonster.SelectSingleNode("div[contains(@class,'sansSerif')]");
var typeSizeAlignment = divSansSerif.SelectSingleNode("h2/em").InnerText; var typeSizeAlignment = divSansSerif.SelectSingleNode("h2/em").InnerText;
var matchesTypeSizeAlignment = new Regex("(?<type>.*) de taille (?<size>.*), (?<alignment>.*)").Match(typeSizeAlignment); var matchesTypeSizeAlignment = new Regex("(?<type>.*) de taille (?<size>.*), (?<alignment>.*)").Match(typeSizeAlignment);
monster.Type = matchesTypeSizeAlignment.Groups["type"].Value; monster.Type = matchesTypeSizeAlignment.Groups["type"].Value;
monster.Size = matchesTypeSizeAlignment.Groups["size"].Value; monster.Size = matchesTypeSizeAlignment.Groups["size"].Value;
monster.Alignment = matchesTypeSizeAlignment.Groups["alignment"].Value; monster.Alignment = matchesTypeSizeAlignment.Groups["alignment"].Value;
var divRed = divSansSerif.SelectSingleNode("div[@class='red']"); var divRed = divSansSerif.SelectSingleNode("div[contains(@class,'red')]");
monster.Strength = divRed.SelectSingleNode("strong").NextSibling.InnerText; monster.Strength = divRed.SelectSingleNode("strong").NextSibling.InnerText;
//monster.LevelType = nodeSpell.SelectSingleNode("h2/em").InnerText; //monster.LevelType = nodeSpell.SelectSingleNode("h2/em").InnerText;
//monster.Level = spell.LevelType.Split(new string[] { " - " }, StringSplitOptions.None)[0].Split(' ')[1]; //monster.Level = spell.LevelType.Split(new string[] { " - " }, StringSplitOptions.None)[0].Split(' ')[1];