1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-30 15:06:06 +00:00

Correctif source de données

This commit is contained in:
Yan Maniez 2018-06-22 17:28:03 +02:00
parent d11371ae80
commit 80df171c5e
2 changed files with 39 additions and 4 deletions

View file

@ -92,7 +92,42 @@ namespace AideDeJeu.Tools
var paragraphBlock = ininblock as Markdig.Syntax.ParagraphBlock;
//DumpParagraphBlock(paragraphBlock);
var str = paragraphBlock.Inline.ToContainerString();
var match = regex.Match(str);
var properties = new List<Tuple<string, Action<Spell, string>>>()
{
new Tuple<string, Action<Spell, string>>("NameVO: ", (m, s) => m.NameVO = s),
new Tuple<string, Action<Spell, string>>("CastingTime: ", (m, s) => m.CastingTime = s),
new Tuple<string, Action<Spell, string>>("Components: ", (m, s) => m.Components = s),
new Tuple<string, Action<Spell, string>>("Duration: ", (m, s) => m.Duration = s),
new Tuple<string, Action<Spell, string>>("LevelType: ", (m, s) => m.LevelType = s),
new Tuple<string, Action<Spell, string>>("Range: ", (m, s) => m.Range = s),
new Tuple<string, Action<Spell, string>>("Source: ", (m, s) => m.Source = s),
new Tuple<string, Action<Spell, string>>("Classes: ", (m, s) => m.Source += s),
new Tuple<string, Action<Spell, string>>("", (m,s) =>
{
//if (m.Alignment != null)
//{
//App.Current.MainPage.DisplayAlert("Erreur de parsing", s, "OK");
//}
////Debug.Assert(monster.Alignment == null, str);
//var regexx = new Regex("(?<type>.*) de taille (?<size>.*), (?<alignment>.*)");
//var matchh = regexx.Match(s);
//m.Alignment = matchh.Groups["alignment"].Value;
//m.Size = matchh.Groups["size"].Value;
//m.Type = matchh.Groups["type"].Value;
})
};
foreach (var property in properties)
{
if (str.StartsWith(property.Item1))
{
property.Item2.Invoke(spell, str.Substring(property.Item1.Length));
break;
}
}
/*var match = regex.Match(str);
var key = match.Groups["key"].Value;
var value = match.Groups["value"].Value;
switch (key)
@ -121,7 +156,7 @@ namespace AideDeJeu.Tools
case "Classes":
spell.Source += value;
break;
}
}*/
}
}

View file

@ -55,7 +55,7 @@ namespace AideDeJeu.ViewModels
{
resourceName = "AideDeJeu.Data.spells_vo.md";
var md = await Tools.Helpers.GetResourceStringAsync(resourceName);
_AllItems = Tools.MarkdownExtensions.MarkdownToMonsters(md);
_AllItems = Tools.MarkdownExtensions.MarkdownToSpells(md);
}
break;
case ItemSourceType.SpellHD:
@ -80,7 +80,7 @@ namespace AideDeJeu.ViewModels
// Yan : c'est pas plutôt cette partie qui devrait être dans une autre Task ?
var filterViewModel = Main.GetFilterViewModel(ItemSourceType);
var items = await filterViewModel.FilterItems(await GetAllItemsAsync(), token);
Main.Items = items;
Main.Items = items.ToList();
//await Task.Run(async () => {
// Yan : plus besoin de boucle si on change toute la liste d'un coup ;)
// Yan : indispensable de repasser sur l'ui thread pour la version uwp