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

Comparers

This commit is contained in:
Yan Maniez 2019-06-13 23:26:00 +02:00
parent 7f2392669c
commit e1bf110ec8

View file

@ -361,18 +361,12 @@ namespace AideDeJeu.ViewModels.Library
using (var context = await StoreViewModel.GetLibraryContextAsync())
{
return context.Monsters.Where(monster =>
monster != null &&
monster.Family == this.Family &&
monster.Type.Contains(type) &&
(string.IsNullOrEmpty(size) || (monster.Size != null && monster.Size.Equals(size))) &&
(string.IsNullOrEmpty(source) || (monster.Source != null && monster.Source.Contains(source))) &&
(string.IsNullOrEmpty(terrain) || (monster.Terrain != null && monster.Terrain.Contains(terrain))) &&
challengeComparer.Compare(monster.Challenge, minChallenge) >= 0 &&
challengeComparer.Compare(monster.Challenge, maxChallenge) <= 0 &&
(
(Helpers.RemoveDiacritics(monster.Name).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower())) ||
(Helpers.RemoveDiacritics(monster.AltNameText ?? string.Empty).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower()))
)
MatchEquals(monster.Family, this.Family) &&
MatchContains(monster.Type, type) &&
MatchEquals(monster.Size, size) &&
MatchContains(monster.Terrain, terrain) &&
MatchRange(monster.Challenge, minChallenge, maxChallenge, challengeComparer) &&
MatchSearch(monster)
).OrderBy(monster => Helpers.RemoveDiacritics(monster.Name)).ToList();
}
}