SortNameComparer.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using MediaBrowser.Controller.Entities;
  3. using MediaBrowser.Controller.Sorting;
  4. using MediaBrowser.Model.Querying;
  5. namespace Emby.Server.Implementations.Sorting
  6. {
  7. /// <summary>
  8. /// Class SortNameComparer
  9. /// </summary>
  10. public class SortNameComparer : IBaseItemComparer
  11. {
  12. /// <summary>
  13. /// Compares the specified x.
  14. /// </summary>
  15. /// <param name="x">The x.</param>
  16. /// <param name="y">The y.</param>
  17. /// <returns>System.Int32.</returns>
  18. public int Compare(BaseItem x, BaseItem y)
  19. {
  20. if (x == null)
  21. throw new ArgumentNullException(nameof(x));
  22. if (y == null)
  23. throw new ArgumentNullException(nameof(y));
  24. return string.Compare(x.SortName, y.SortName, StringComparison.CurrentCultureIgnoreCase);
  25. }
  26. /// <summary>
  27. /// Gets the name.
  28. /// </summary>
  29. /// <value>The name.</value>
  30. public string Name => ItemSortBy.SortName;
  31. }
  32. }