RuntimeComparer.cs 862 B

1234567891011121314151617181920212223242526272829303132
  1. using MediaBrowser.Controller.Entities;
  2. using MediaBrowser.Controller.Sorting;
  3. using MediaBrowser.Model.Querying;
  4. namespace Emby.Server.Implementations.Sorting
  5. {
  6. /// <summary>
  7. /// Class RuntimeComparer
  8. /// </summary>
  9. public class RuntimeComparer : IBaseItemComparer
  10. {
  11. /// <summary>
  12. /// Compares the specified x.
  13. /// </summary>
  14. /// <param name="x">The x.</param>
  15. /// <param name="y">The y.</param>
  16. /// <returns>System.Int32.</returns>
  17. public int Compare(BaseItem x, BaseItem y)
  18. {
  19. return (x.RunTimeTicks ?? 0).CompareTo(y.RunTimeTicks ?? 0);
  20. }
  21. /// <summary>
  22. /// Gets the name.
  23. /// </summary>
  24. /// <value>The name.</value>
  25. public string Name
  26. {
  27. get { return ItemSortBy.Runtime; }
  28. }
  29. }
  30. }