aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Ava/UI/Models
diff options
context:
space:
mode:
authorSamusAranX <hallo@emmalyx.site>2023-05-12 01:56:37 +0200
committerGitHub <noreply@github.com>2023-05-12 01:56:37 +0200
commit531da8a1c0760c8ebf121ac83ba4c840ead9e443 (patch)
tree1cc849b054d33f0981444e9ba7323c0a15235f92 /src/Ryujinx.Ava/UI/Models
parent5cbdfbc7a4b7413a4f633c77190a79bfc6520e98 (diff)
Changed LastPlayed field from string to nullable DateTime (#4861)
* Changed LastPlayed field from string to nullable DateTime Added ApplicationData.LastPlayedString property Added NullableDateTimeConverter for the DateTime->string conversion in Avalonia * Added migration from string-based last_played to DateTime-based last_played_utc * Updated comment style * Added MarkupExtension to NullableDateTimeConverter and changed its usage Cleaned up leftover usings * Missed one comment
Diffstat (limited to 'src/Ryujinx.Ava/UI/Models')
-rw-r--r--src/Ryujinx.Ava/UI/Models/Generic/LastPlayedSortComparer.cs15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/Ryujinx.Ava/UI/Models/Generic/LastPlayedSortComparer.cs b/src/Ryujinx.Ava/UI/Models/Generic/LastPlayedSortComparer.cs
index 98caceb5..3627ada9 100644
--- a/src/Ryujinx.Ava/UI/Models/Generic/LastPlayedSortComparer.cs
+++ b/src/Ryujinx.Ava/UI/Models/Generic/LastPlayedSortComparer.cs
@@ -1,4 +1,3 @@
-using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ui.App.Common;
using System;
using System.Collections.Generic;
@@ -14,20 +13,20 @@ namespace Ryujinx.Ava.UI.Models.Generic
public int Compare(ApplicationData x, ApplicationData y)
{
- string aValue = x.LastPlayed;
- string bValue = y.LastPlayed;
+ var aValue = x.LastPlayed;
+ var bValue = y.LastPlayed;
- if (aValue == LocaleManager.Instance[LocaleKeys.Never])
+ if (!aValue.HasValue)
{
- aValue = DateTime.UnixEpoch.ToString();
+ aValue = DateTime.UnixEpoch;
}
- if (bValue == LocaleManager.Instance[LocaleKeys.Never])
+ if (!bValue.HasValue)
{
- bValue = DateTime.UnixEpoch.ToString();
+ bValue = DateTime.UnixEpoch;
}
- return (IsAscending ? 1 : -1) * DateTime.Compare(DateTime.Parse(bValue), DateTime.Parse(aValue));
+ return (IsAscending ? 1 : -1) * DateTime.Compare(bValue.Value, aValue.Value);
}
}
} \ No newline at end of file