예제 #1
0
 public BeatModsQuery(string forGameVersion)
 {
     search = null;
     status = ModStatus.Approved;
     this.forGameVersion = forGameVersion;
     sort           = BeatModsSort.None;
     sortDescending = false;
 }
예제 #2
0
        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");
            }
        }
예제 #3
0
        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));
        }
예제 #4
0
 public IOrderedEnumerable <Mod> GetModsSortedBy(BeatModsSort sort, bool descending = true)
 {
     return(sort.SortModList(AllMods, descending));
 }