From b6583761383d6f7ca8f21c1f602becac1c03fedc Mon Sep 17 00:00:00 2001 From: unitycoder Date: Thu, 28 Nov 2024 22:59:23 +0200 Subject: [PATCH] add SRP column sorting --- UnityLauncherPro/MainWindow.xaml | 2 +- UnityLauncherPro/MainWindow.xaml.cs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/UnityLauncherPro/MainWindow.xaml b/UnityLauncherPro/MainWindow.xaml index 14bab67..594a42d 100644 --- a/UnityLauncherPro/MainWindow.xaml +++ b/UnityLauncherPro/MainWindow.xaml @@ -183,7 +183,7 @@ - + diff --git a/UnityLauncherPro/MainWindow.xaml.cs b/UnityLauncherPro/MainWindow.xaml.cs index 5d4bec4..91b892f 100644 --- a/UnityLauncherPro/MainWindow.xaml.cs +++ b/UnityLauncherPro/MainWindow.xaml.cs @@ -3334,6 +3334,12 @@ public int Compare(Object a, Object b) if (((Project)a).TargetPlatform == null) return direction == ListSortDirection.Ascending ? -1 : 1; if (((Project)b).TargetPlatform == null) return direction == ListSortDirection.Ascending ? 1 : -1; return direction == ListSortDirection.Ascending ? ((Project)a).TargetPlatform.CompareTo(((Project)b).TargetPlatform) : ((Project)b).TargetPlatform.CompareTo(((Project)a).TargetPlatform); + case "SRP": + // handle null values + if (((Project)a).SRP == null && ((Project)b).SRP == null) return 0; + if (((Project)a).SRP == null) return direction == ListSortDirection.Ascending ? -1 : 1; + if (((Project)b).SRP == null) return direction == ListSortDirection.Ascending ? 1 : -1; + return direction == ListSortDirection.Ascending ? ((Project)a).SRP.CompareTo(((Project)b).SRP) : ((Project)b).SRP.CompareTo(((Project)a).SRP); default: return 0; }