public BeatModsQuery(string forGameVersion) { search = null; status = ModStatus.Approved; this.forGameVersion = forGameVersion; sort = BeatModsSort.None; sortDescending = false; }
public static string GetSortName(this BeatModsSort sort) { switch (sort) { default: case BeatModsSort.None: return(string.Empty); case BeatModsSort.Category: return("category_lower"); case BeatModsSort.Name: return("name_lower"); case BeatModsSort.Status: return("status_lower"); case BeatModsSort.Author: return("author.username_lower"); case BeatModsSort.UpdatedDate: return("updatedDate"); } }
public static IOrderedEnumerable <Mod> SortModList(this BeatModsSort sort, IEnumerable <Mod> modsList, bool descending = true) { if (sort == BeatModsSort.None) { return(modsList.OrderBy((e) => 1)); } Func <Mod, string> ordener = (e) => { switch (sort) { default: case BeatModsSort.None: return(string.Empty); case BeatModsSort.Category: return(e.category); case BeatModsSort.Name: return(e.Name); case BeatModsSort.Status: return(e.status); case BeatModsSort.Author: return(e.author.username); case BeatModsSort.UpdatedDate: return(e.updatedDate); } }; return(descending ? modsList.OrderByDescending(ordener) : modsList.OrderBy(ordener)); }
public IOrderedEnumerable <Mod> GetModsSortedBy(BeatModsSort sort, bool descending = true) { return(sort.SortModList(AllMods, descending)); }