| | | 1 | | #pragma warning disable CS1591 |
| | | 2 | | |
| | | 3 | | using System; |
| | | 4 | | using System.Collections; |
| | | 5 | | using System.Collections.Generic; |
| | | 6 | | using System.Globalization; |
| | | 7 | | using System.Linq; |
| | | 8 | | using Jellyfin.Extensions; |
| | | 9 | | |
| | | 10 | | namespace MediaBrowser.Controller.Sorting |
| | | 11 | | { |
| | | 12 | | public static class SortExtensions |
| | | 13 | | { |
| | 0 | 14 | | private static readonly StringComparer _comparer = StringComparer.Create(CultureInfo.InvariantCulture, CompareOp |
| | | 15 | | |
| | | 16 | | public static IEnumerable<T> OrderByString<T>(this IEnumerable<T> list, Func<T, string> getName) |
| | | 17 | | { |
| | 0 | 18 | | return list.OrderBy(getName, _comparer); |
| | | 19 | | } |
| | | 20 | | |
| | | 21 | | public static IEnumerable<T> OrderByStringDescending<T>(this IEnumerable<T> list, Func<T, string> getName) |
| | | 22 | | { |
| | 0 | 23 | | return list.OrderByDescending(getName, _comparer); |
| | | 24 | | } |
| | | 25 | | |
| | | 26 | | public static IOrderedEnumerable<T> ThenByString<T>(this IOrderedEnumerable<T> list, Func<T, string> getName) |
| | | 27 | | { |
| | 0 | 28 | | return list.ThenBy(getName, _comparer); |
| | | 29 | | } |
| | | 30 | | |
| | | 31 | | public static IOrderedEnumerable<T> ThenByStringDescending<T>(this IOrderedEnumerable<T> list, Func<T, string> g |
| | | 32 | | { |
| | 0 | 33 | | return list.ThenByDescending(getName, _comparer); |
| | | 34 | | } |
| | | 35 | | } |
| | | 36 | | } |