LastPlayedSortComparer.cs 690 B

123456789101112131415161718192021222324252627
  1. using Ryujinx.Ui.App.Common;
  2. using System;
  3. using System.Collections;
  4. namespace Ryujinx.Ava.Ui.Models
  5. {
  6. internal class LastPlayedSortComparer : IComparer
  7. {
  8. public int Compare(object x, object y)
  9. {
  10. string aValue = (x as ApplicationData).LastPlayed;
  11. string bValue = (y as ApplicationData).LastPlayed;
  12. if (aValue == "Never")
  13. {
  14. aValue = DateTime.UnixEpoch.ToString();
  15. }
  16. if (bValue == "Never")
  17. {
  18. bValue = DateTime.UnixEpoch.ToString();
  19. }
  20. return DateTime.Compare(DateTime.Parse(bValue), DateTime.Parse(aValue));
  21. }
  22. }
  23. }