From e62c2e3646cf6817f3ddfd54c8063b4cbe9afed4 Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 7 Apr 2020 08:51:20 -0500 Subject: [PATCH] PlayMovie dialog - simplify a bit --- BizHawk.Client.EmuHawk/movie/PlayMovie.cs | 46 ++++++----------------- 1 file changed, 12 insertions(+), 34 deletions(-) diff --git a/BizHawk.Client.EmuHawk/movie/PlayMovie.cs b/BizHawk.Client.EmuHawk/movie/PlayMovie.cs index 952c512546..05f6d7a3a0 100644 --- a/BizHawk.Client.EmuHawk/movie/PlayMovie.cs +++ b/BizHawk.Client.EmuHawk/movie/PlayMovie.cs @@ -9,7 +9,7 @@ using System.Windows.Forms; using BizHawk.Client.Common; using BizHawk.Common; -using BizHawk.Common.PathExtensions; +using BizHawk.Common.CollectionExtensions; using BizHawk.Emulation.Common; namespace BizHawk.Client.EmuHawk @@ -494,40 +494,18 @@ namespace BizHawk.Client.EmuHawk _sortDetailsReverse = false; } - switch (columnName) + detailsList = columnName switch { - // Header, Value - case "Header": - if (_sortDetailsReverse) - { - detailsList = detailsList - .OrderByDescending(x => x.Keys) - .ThenBy(x => x.Values).ToList(); - } - else - { - detailsList = detailsList - .OrderBy(x => x.Keys) - .ThenBy(x => x.Values).ToList(); - } - - break; - case "Value": - if (_sortDetailsReverse) - { - detailsList = detailsList - .OrderByDescending(x => x.Values) - .ThenBy(x => x.Keys).ToList(); - } - else - { - detailsList = detailsList - .OrderBy(x => x.Values) - .ThenBy(x => x.Keys).ToList(); - } - - break; - } + "Header" => detailsList + .OrderBy(x => x.Keys, _sortDetailsReverse) + .ThenBy(x => x.Values) + .ToList(), + "Value" => detailsList + .OrderBy(x => x.Values, _sortDetailsReverse) + .ThenBy(x => x.Keys) + .ToList(), + _ => detailsList + }; DetailsView.Items.Clear(); foreach (var detail in detailsList)