Exemplo n.º 1
0
 /// <summary>
 /// Sorts an <see cref="Enumerable"/> list of <see cref="PKM"/> objects to display those originally obtained by the current <see cref="ITrainerInfo"/>.
 /// </summary>
 /// <param name="list">Source list to sort</param>
 /// <param name="trainer">The <see cref="ITrainerInfo"/> requesting the sorted data.</param>
 /// <returns>Enumerable list that is sorted</returns>
 public static IEnumerable <PKM> OrderByOwnership(this IEnumerable <PKM> list, ITrainerInfo trainer)
 {
     return(list.InitialSortBy()
            .ThenByDescending(p => trainer.IsOriginalHandler(p, ((GameVersion)trainer.Game).IsValidSavedVersion())) // true first
            .ThenByDescending(p => string.Equals(p.OT_Name, trainer.OT, StringComparison.CurrentCultureIgnoreCase))
            .OrderByTrainer()
            .ThenBy(p => p.Species)
            .FinalSortBy());
 }