mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-06-02 21:28:46 +02:00
f06d22d6f0
* Rename Ryujinx.UI.Common * Rename Ryujinx.UI.LocaleGenerator * Update in Files AboutWindow * Configuration State * Rename projects * Ryujinx/UI * Fix build * Main remaining inconsistencies * HLE.UI Namespace * HLE.UI Files * Namespace * Ryujinx.UI.Common.Configuration.UI * Ryujinx.UI.Common,Configuration.UI Files * More instances
32 lines
848 B
C#
32 lines
848 B
C#
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);
|
|
}
|
|
}
|
|
}
|