private IList<FightActionDescriptor> ParseFightActions()
{
var documet = new HtmlDocument();
documet.LoadHtml(File.ReadAllText("Data/actions.html"));
string x = FightActionDescriptor.GenerateClassString(documet);
var properties = FightActionDescriptor.GetPropertyNames(documet);
return documet.DocumentNode.SelectSingleNode("//table")
.Descendants("tr")
.Skip(1)
.Select(tr =>
{
var res = new FightActionDescriptor();
foreach (var tuple in tr.Elements("td").Select(td => td.InnerText).Zip(properties, Tuple.Create))
{
int val;
if (tuple.Item2 == nameof(res.ImprovedSkill))
{
res.ImprovedSkill = int.Parse(tuple.Item1.Split(':')[0]);
continue;
}
if (int.TryParse(tuple.Item1, out val))
res.GetType().GetProperty(tuple.Item2).SetValue(res, val);
else
res.GetType().GetProperty(tuple.Item2).SetValue(res, tuple.Item1);
}
return res;
})
.ToArray();
}