From d8756cfcf7f2b55cbc506f6210392a5604f57bc8 Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Mon, 27 Feb 2023 17:21:02 +0800 Subject: [PATCH] Script list is now sorted in alphabetical order --- SHADE_Managed/src/Scripts/ScriptStore.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/SHADE_Managed/src/Scripts/ScriptStore.cxx b/SHADE_Managed/src/Scripts/ScriptStore.cxx index aba63eb2..5d3a3bac 100644 --- a/SHADE_Managed/src/Scripts/ScriptStore.cxx +++ b/SHADE_Managed/src/Scripts/ScriptStore.cxx @@ -903,6 +903,12 @@ namespace SHADE { return pair->type; } + + /* Sort */ + System::String^ sortKeyAccessor(System::Type^ type) + { + return type->Name; + } } void ScriptStore::refreshScriptTypeList() @@ -926,6 +932,10 @@ namespace SHADE Func^ selector = gcnew Func(selectorFunc); scriptTypeList = Enumerable::Select(whereResult, selector); + /* Sort: By Alphabetical Order */ + Func^ sorter = gcnew Func(sortKeyAccessor); + scriptTypeList = Enumerable::OrderBy(scriptTypeList, sorter); + // Log std::ostringstream oss; oss << "[ScriptStore] Successfully retrieved references to " << Enumerable::Count(scriptTypeList) -- 2.40.1