blob: 224f78f458709cece6522a75d6fb2a7ca553ab7f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
using Ryujinx.UI.App.Common;
using System;
using System.Collections.Generic;
namespace Ryujinx.Ava.UI.Models.Generic
{
internal class LastPlayedSortComparer : IComparer<ApplicationData>
{
public LastPlayedSortComparer() { }
public LastPlayedSortComparer(bool isAscending) { IsAscending = isAscending; }
public bool IsAscending { get; }
public int Compare(ApplicationData x, ApplicationData y)
{
DateTime aValue = DateTime.UnixEpoch, bValue = DateTime.UnixEpoch;
if (x?.LastPlayed != null)
{
aValue = x.LastPlayed.Value;
}
if (y?.LastPlayed != null)
{
bValue = y.LastPlayed.Value;
}
return (IsAscending ? 1 : -1) * DateTime.Compare(aValue, bValue);
}
}
}
|