1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-12-22 18:13:23 +00:00

Key/Value

This commit is contained in:
Yan Maniez 2019-04-14 00:24:35 +02:00
parent bfb19ea6ad
commit 61f4840315
2 changed files with 33 additions and 12 deletions

View file

@ -307,6 +307,8 @@ namespace AideDeJeu.ViewModels
{
Item,
Property,
Key,
Value,
None,
}
public class ParsedComment
@ -322,7 +324,10 @@ namespace AideDeJeu.ViewModels
var regex = new Regex("(?<closing>/?)(?<item>\\w+)(\\s+((?<name>\\w+)=\"(?<value>.*?)\"))*");
var match = regex.Match(comment);
Name = match.Groups["item"].Value;
Type = Name.EndsWith("Item") || Name.EndsWith("Items") ? ParsedCommentType.Item : Name != "br" ? ParsedCommentType.Property : ParsedCommentType.None;
Type = Name.EndsWith("Item") || Name.EndsWith("Items") ? ParsedCommentType.Item :
Name.EndsWith("Key") ? ParsedCommentType.Key :
Name.EndsWith("Value") ? ParsedCommentType.Value :
Name != "br" ? ParsedCommentType.Property : ParsedCommentType.None;
IsClosing = !string.IsNullOrEmpty(match.Groups["closing"].Value);
var names = match.Groups["name"].Captures;
var values = match.Groups["value"].Captures;