Use Berry’s method

This commit is contained in:
Isaac Marovitz 2024-07-19 17:38:57 +01:00
commit 397fc9000f
No known key found for this signature in database
GPG key ID: 97250B2B09A132E1

View file

@ -135,23 +135,20 @@ namespace Ryujinx.Ava.UI.ViewModels
list.Sort((first, second) => list.Sort((first, second) =>
{ {
var firstVersionString = first.Control.DisplayVersionString.ToString(); var firstVersion = first.Control.DisplayVersionString.ToString();
var secondVersionString = second.Control.DisplayVersionString.ToString(); var secondVersion = second.Control.DisplayVersionString.ToString();
if (string.IsNullOrEmpty(firstVersionString)) if (string.IsNullOrEmpty(firstVersion))
{ {
return -1; return -1;
} }
if (string.IsNullOrEmpty(secondVersionString)) if (string.IsNullOrEmpty(secondVersion))
{ {
return 1; return 1;
} }
var firstVersion = Version.Parse(firstVersionString.Where(x => char.IsDigit(x) || x == '.').ToArray()); return String.Compare(firstVersion, secondVersion, StringComparison.InvariantCulture) * -1;
var secondVersion = Version.Parse(secondVersionString.Where(x => char.IsDigit(x) || x == '.').ToArray());
return firstVersion.CompareTo(secondVersion) * -1;
}); });
Views.Clear(); Views.Clear();