1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 22:45:44 +00:00

SearchText Null

This commit is contained in:
Yan Maniez 2018-06-24 15:59:41 +02:00
parent 22c95cdd94
commit bf0f3600f9
4 changed files with 30 additions and 23 deletions

View file

@ -133,7 +133,7 @@ namespace AideDeJeu.ViewModels
spell.Source.Contains(source) &&
spell.Source.Contains(classe) &&
spell.Type.Contains(rituel) &&
Helpers.RemoveDiacritics(spell.NamePHB).ToLower().Contains(Helpers.RemoveDiacritics(SearchText).ToLower());
Helpers.RemoveDiacritics(spell.NamePHB).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower());
}).OrderBy(spell => spell.NamePHB)
.AsEnumerable();
}, token);
@ -379,7 +379,7 @@ namespace AideDeJeu.ViewModels
monster.Source.Contains(source) &&
powerComparer.Compare(monster.Challenge, minPower) >= 0 &&
powerComparer.Compare(monster.Challenge, maxPower) <= 0 &&
Helpers.RemoveDiacritics(monster.NamePHB).ToLower().Contains(Helpers.RemoveDiacritics(SearchText).ToLower());
Helpers.RemoveDiacritics(monster.NamePHB).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower());
})
.OrderBy(monster => monster.NamePHB)
.AsEnumerable();

View file

@ -107,9 +107,11 @@ namespace AideDeJeuCmd
};
foreach (var classe in classes)
{
//Console.WriteLine(classe);
result += string.Format("## {0}\r\n\r\n", classe);
foreach (var level in levels)
{
//Console.WriteLine(level);
var spells = items.Where(s => s.Level == level && s.Source.Contains(classe)).OrderBy(s => s.Name).Select(s => string.Format("* [{0}](spells_hd.md#{1})", s.Name, Helpers.IdFromName(s.Name))).ToList();
if (spells.Count > 0)
{
@ -119,6 +121,7 @@ namespace AideDeJeuCmd
}
}
}
Console.WriteLine(result);
await SaveStringAsync(dataDir + "spells_hd_by_class_level.md", result);
}
@ -126,6 +129,7 @@ namespace AideDeJeuCmd
{
string dataDir = @"..\..\..\..\..\Data\";
await CreateIndexes();
//var spellsVF = LoadJSon<IEnumerable<Spell>>(dataDir + "spells_vf_full.json");
//var spellsVO = LoadJSon<IEnumerable<Spell>>(dataDir + "spells_vo_full.json");
//var spellsHD = LoadJSon<IEnumerable<Spell>>(dataDir + "spells_hd_full.json");
@ -133,20 +137,20 @@ namespace AideDeJeuCmd
//var monstersVO = LoadJSon<IEnumerable<Monster>>(dataDir + "monsters_vo_full.json");
//var result = string.Empty;
var md = await LoadStringAsync(dataDir + "spells_vo.md");
//var md = await LoadStringAsync(dataDir + "spells_vo.md");
var regex = new Regex("\\[(?<name>.*?)\\]\\: spells_hd\\.md\\#(?<id>.*?)\n");
var matches = regex.Matches(md);
foreach(Match match in matches)
{
Debug.WriteLine(match.Value);
var oldMatch = match.Value;
var name = match.Groups["name"].Value;
var newMatch = string.Format("[{0}]: spells_hd.md#{1}\n", name, Helpers.IdFromName(name));
//var regex = new Regex("\\[(?<name>.*?)\\]\\: spells_hd\\.md\\#(?<id>.*?)\n");
//var matches = regex.Matches(md);
//foreach(Match match in matches)
//{
// Debug.WriteLine(match.Value);
// var oldMatch = match.Value;
// var name = match.Groups["name"].Value;
// var newMatch = string.Format("[{0}]: spells_hd.md#{1}\n", name, Helpers.IdFromName(name));
md = md.Replace(oldMatch, newMatch);
}
await SaveStringAsync(dataDir + "spells_vo_tmp.md", md);
// md = md.Replace(oldMatch, newMatch);
//}
//await SaveStringAsync(dataDir + "spells_vo_tmp.md", md);
//foreach(var spell in spellsVF)
//{
// var nameAideDD = spell.Name;

View file

@ -15,7 +15,10 @@ namespace AideDeJeuWeb.Controllers
[HttpGet("{classe}")]
public async Task<IEnumerable<CardData>> Get(string classe)
{
var items = AideDeJeu.Tools.Helpers.GetResourceObject<IEnumerable<Spell>>("AideDeJeu.Data.spells_vf.json");
//var items = AideDeJeu.Tools.Helpers.GetResourceObject<IEnumerable<Spell>>("AideDeJeu.Data.spells_vf.json");
var md = await AideDeJeu.Tools.Helpers.GetResourceStringAsync("AideDeJeu.Data.spells_hd.md");
var items = AideDeJeu.Tools.MarkdownExtensions.MarkdownToSpells(md);
var fitems = items.Where(it => it.Source.Contains(classe)).OrderBy(it => it.Level).ThenBy(it => it.NamePHB);
var cardDatas = new List<CardData>();

View file

@ -44,7 +44,7 @@
* [Apaisement des émotions](spells_hd.md#apaisement-des-émotions)
* [Bouche magique](spells_hd.md#bouche-magique)
* [Briser](spells_hd.md#briser)
* [Cécité/surdité](spells_hd.md#cécité/surdité)
* [Cécité/surdité](spells_hd.md#cécitésurdité)
* [Chauffer le métal](spells_hd.md#chauffer-le-métal)
* [Déblocage](spells_hd.md#déblocage)
* [Détection des pensées](spells_hd.md#détection-des-pensées)
@ -186,7 +186,7 @@
* [Apaisement des émotions](spells_hd.md#apaisement-des-émotions)
* [Arme spirituelle](spells_hd.md#arme-spirituelle)
* [Augure](spells_hd.md#augure)
* [Cécité/surdité](spells_hd.md#cécité/surdité)
* [Cécité/surdité](spells_hd.md#cécitésurdité)
* [Doux repos](spells_hd.md#doux-repos)
* [Flamme éternelle](spells_hd.md#flamme-éternelle)
* [Immobiliser un humanoïde](spells_hd.md#immobiliser-un-humanoïde)
@ -415,7 +415,7 @@
* [Éclat du soleil](spells_hd.md#éclat-du-soleil)
* [Esprit faible](spells_hd.md#esprit-faible)
* [Formes animales](spells_hd.md#formes-animales)
* [Répulsion/attirance](spells_hd.md#répulsion/attirance)
* [Répulsion/attirance](spells_hd.md#répulsionattirance)
* [Tempête de sable](spells_hd.md#tempête-de-sable)
* [Tremblement de terre](spells_hd.md#tremblement-de-terre)
@ -471,11 +471,11 @@
### Niveau 2
* [Agrandir/rétrécir](spells_hd.md#agrandir/rétrécir)
* [Agrandir/rétrécir](spells_hd.md#agrandirrétrécir)
* [Amélioration de caractéristique](spells_hd.md#amélioration-de-caractéristique)
* [Bourrasque](spells_hd.md#bourrasque)
* [Briser](spells_hd.md#briser)
* [Cécité/surdité](spells_hd.md#cécité/surdité)
* [Cécité/surdité](spells_hd.md#cécitésurdité)
* [Déblocage](spells_hd.md#déblocage)
* [Détection des pensées](spells_hd.md#détection-des-pensées)
* [Flou](spells_hd.md#flou)
@ -640,13 +640,13 @@
### Niveau 2
* [Agrandir/rétrécir](spells_hd.md#agrandir/rétrécir)
* [Agrandir/rétrécir](spells_hd.md#agrandirrétrécir)
* [Arme magique](spells_hd.md#arme-magique)
* [Aura magique de larcaniste](spells_hd.md#aura-magique-de-larcaniste)
* [Bouche magique](spells_hd.md#bouche-magique)
* [Bourrasque](spells_hd.md#bourrasque)
* [Briser](spells_hd.md#briser)
* [Cécité/surdité](spells_hd.md#cécité/surdité)
* [Cécité/surdité](spells_hd.md#cécitésurdité)
* [Corde enchantée](spells_hd.md#corde-enchantée)
* [Déblocage](spells_hd.md#déblocage)
* [Dessiccation](spells_hd.md#dessiccation)
@ -814,7 +814,7 @@
* [Labyrinthe](spells_hd.md#labyrinthe)
* [Mot de pouvoir étourdissant](spells_hd.md#mot-de-pouvoir-étourdissant)
* [Nuage incendiaire](spells_hd.md#nuage-incendiaire)
* [Répulsion/attirance](spells_hd.md#répulsion/attirance)
* [Répulsion/attirance](spells_hd.md#répulsionattirance)
### Niveau 9