Fix Sorting Regression (#4032)

* Fix sorting regression + Remove unsued sort

* Fix GTK

* Attempt 2 to fix GTK

* Whoopsie

* Fix whitspace
This commit is contained in:
Isaac Marovitz 2022-12-05 20:40:06 -05:00 committed by GitHub
parent de06ffb0f7
commit 071c01c235
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 32 additions and 265 deletions

View file

@ -9,46 +9,56 @@ namespace Ryujinx.Ui.Helper
{
string aValue = model.GetValue(a, 5).ToString();
string bValue = model.GetValue(b, 5).ToString();
float aFloat;
float bFloat;
if (aValue.Length > 4 && aValue[^4..] == "mins")
if (aValue.Length > 7 && aValue[^7..] == "minutes")
{
aValue = (float.Parse(aValue[0..^5]) * 60).ToString();
aValue = aValue.Replace("minutes", "");
aFloat = (float.Parse(aValue) * 60);
}
else if (aValue.Length > 3 && aValue[^3..] == "hrs")
else if (aValue.Length > 5 && aValue[^5..] == "hours")
{
aValue = (float.Parse(aValue[0..^4]) * 3600).ToString();
aValue = aValue.Replace("hours", "");
aFloat = (float.Parse(aValue) * 3600);
}
else if (aValue.Length > 4 && aValue[^4..] == "days")
{
aValue = (float.Parse(aValue[0..^5]) * 86400).ToString();
aValue = aValue.Replace("days", "");
aFloat = (float.Parse(aValue) * 86400);
}
else
{
aValue = aValue[0..^1];
aValue = aValue.Replace("seconds", "");
aFloat = float.Parse(aValue);
}
if (bValue.Length > 4 && bValue[^4..] == "mins")
if (bValue.Length > 7 && bValue[^7..] == "minutes")
{
bValue = (float.Parse(bValue[0..^5]) * 60).ToString();
bValue = bValue.Replace("minutes", "");
bFloat = (float.Parse(bValue) * 60);
}
else if (bValue.Length > 3 && bValue[^3..] == "hrs")
else if (bValue.Length > 5 && bValue[^5..] == "hours")
{
bValue = (float.Parse(bValue[0..^4]) * 3600).ToString();
bValue = bValue.Replace("hours", "");
bFloat = (float.Parse(bValue) * 3600);
}
else if (bValue.Length > 4 && bValue[^4..] == "days")
{
bValue = (float.Parse(bValue[0..^5]) * 86400).ToString();
bValue = bValue.Replace("days", "");
bFloat = (float.Parse(bValue) * 86400);
}
else
{
bValue = bValue[0..^1];
bValue = bValue[0..^8];
bFloat = float.Parse(bValue);
}
if (float.Parse(aValue) > float.Parse(bValue))
if (aFloat > bFloat)
{
return -1;
}
else if (float.Parse(bValue) > float.Parse(aValue))
else if (bFloat > aFloat)
{
return 1;
}