SortNameComparer.cs 989 B

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