mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-11-02 16:27:04 +00:00
Parsing level / type
This commit is contained in:
parent
7dadff58a8
commit
751ed87c82
2 changed files with 36 additions and 1 deletions
|
|
@ -9,7 +9,41 @@ namespace AideDeJeuLib.Spells
|
||||||
{
|
{
|
||||||
public class Spell : Item
|
public class Spell : Item
|
||||||
{
|
{
|
||||||
public string LevelType { get; set; }
|
public string LevelType
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return string.Format("{0} - {1}", this.Level, this.Type);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
var re = new Regex("(?<type>.*) de niveau (?<level>\\d).?(?<rituel>\\(rituel\\))?");
|
||||||
|
var match = re.Match(value);
|
||||||
|
this.Type = match.Groups["type"].Value;
|
||||||
|
this.Level = match.Groups["level"].Value;
|
||||||
|
this.Rituel = match.Groups["rituel"].Value;
|
||||||
|
if (string.IsNullOrEmpty(this.Type))
|
||||||
|
{
|
||||||
|
re = new Regex("(?<type>.*), (?<level>tour de magie)");
|
||||||
|
match = re.Match(value);
|
||||||
|
if(match.Groups["level"].Value == "tour de magie")
|
||||||
|
{
|
||||||
|
this.Type = match.Groups["type"].Value;
|
||||||
|
this.Level = "0"; // match.Groups["level"].Value;
|
||||||
|
this.Rituel = match.Groups["rituel"].Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine(value);
|
||||||
|
re = new Regex("level (?<level>\\d) - (?<type>.*?) ?(?<rituel>\\(ritual\\))?");
|
||||||
|
match = re.Match(value);
|
||||||
|
this.Type = match.Groups["type"].Value;
|
||||||
|
this.Level = match.Groups["level"].Value;
|
||||||
|
this.Rituel = match.Groups["rituel"].Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
public string Level { get; set; }
|
public string Level { get; set; }
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
public string Concentration { get; set; }
|
public string Concentration { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ namespace AideDeJeu.Tools
|
||||||
{
|
{
|
||||||
HtmlNodesToFormatedString(node.ChildNodes, fs, attributes);
|
HtmlNodesToFormatedString(node.ChildNodes, fs, attributes);
|
||||||
fs.Spans.Add(new Span() { Text = "\r\n" });
|
fs.Spans.Add(new Span() { Text = "\r\n" });
|
||||||
|
fs.Spans.Add(new Span() { Text = "\r\n" });
|
||||||
}
|
}
|
||||||
else if (node.NodeType == XmlNodeType.Element)
|
else if (node.NodeType == XmlNodeType.Element)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue