From dbabe1527cd2662395c66d25b7801957a20136b8 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Sun, 18 Aug 2024 14:01:09 +0100 Subject: [PATCH] Sort selector lists alphabetically --- project/code/TMV/UI/MissionSelector.cs | 7 ++++--- project/code/TMV/UI/ModelSelector.cs | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/project/code/TMV/UI/MissionSelector.cs b/project/code/TMV/UI/MissionSelector.cs index 89b5224..338363c 100644 --- a/project/code/TMV/UI/MissionSelector.cs +++ b/project/code/TMV/UI/MissionSelector.cs @@ -60,7 +60,8 @@ public partial class MissionSelector : Control _LoadButton.Disabled = true; _Campaigns.AddItem("Original Missions"); - foreach (var c in Directory.GetDirectories(_installPaths.fmsPath)) + var paths = Directory.GetDirectories(_installPaths.fmsPath); + foreach (var c in paths.OrderBy(s => s)) { _Campaigns.AddItem(c.TrimPrefix(_installPaths.fmsPath)); } @@ -82,8 +83,8 @@ public partial class MissionSelector : Control } string[] extensions = { "mis", "cow" }; - campaignPath = idx == 0 ? _installPaths.omsPath : _installPaths.fmsPath + _Campaigns.GetItemText((int)idx); - foreach (var f in Directory.GetFiles(campaignPath)) + var paths = Directory.GetFiles(campaignPath); + foreach (var f in paths.OrderBy(s => s)) { if (extensions.Contains(f.GetExtension().ToLower())) { diff --git a/project/code/TMV/UI/ModelSelector.cs b/project/code/TMV/UI/ModelSelector.cs index 79fe286..b8bdaba 100644 --- a/project/code/TMV/UI/ModelSelector.cs +++ b/project/code/TMV/UI/ModelSelector.cs @@ -59,7 +59,8 @@ public partial class ModelSelector : Control _Models.Clear(); _LoadButton.Disabled = true; - foreach (var m in Directory.GetFiles(_extractedObjectsPath, "*.bin", SearchOption.AllDirectories)) + var paths = Directory.GetFiles(_extractedObjectsPath, "*.bin", SearchOption.AllDirectories); + foreach (var m in paths.OrderBy(s => s)) { _Models.AddItem(m.TrimPrefix(_extractedObjectsPath)); }