mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2025-06-30 06:30:46 -07:00
Move solution and projects to src
This commit is contained in:
33
src/Ryujinx.Ava/UI/Models/Generic/LastPlayedSortComparer.cs
Normal file
33
src/Ryujinx.Ava/UI/Models/Generic/LastPlayedSortComparer.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
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)
|
||||
{
|
||||
string aValue = x.LastPlayed;
|
||||
string bValue = y.LastPlayed;
|
||||
|
||||
if (aValue == LocaleManager.Instance[LocaleKeys.Never])
|
||||
{
|
||||
aValue = DateTime.UnixEpoch.ToString();
|
||||
}
|
||||
|
||||
if (bValue == LocaleManager.Instance[LocaleKeys.Never])
|
||||
{
|
||||
bValue = DateTime.UnixEpoch.ToString();
|
||||
}
|
||||
|
||||
return (IsAscending ? 1 : -1) * DateTime.Compare(DateTime.Parse(bValue), DateTime.Parse(aValue));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user