From e1baf36e4f18fb55aa15d223f10944bf96e011f4 Mon Sep 17 00:00:00 2001 From: "Eric P. Nusbaum" Date: Fri, 13 Sep 2024 19:54:28 -0400 Subject: [PATCH] If only specifying path (`-P`), load every module in that folder - Scans folder for MDF Files - Loads each module with an associated MDF file --- MBBSEmu/Program.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/MBBSEmu/Program.cs b/MBBSEmu/Program.cs index 25525722..cea1c8ea 100644 --- a/MBBSEmu/Program.cs +++ b/MBBSEmu/Program.cs @@ -26,7 +26,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; using System.Text.Json; using System.Text.Json.Serialization; using System.Threading; @@ -389,7 +388,19 @@ private void Run(string[] args) } //Setup Modules - if (!string.IsNullOrEmpty(_moduleIdentifier)) + if (!string.IsNullOrEmpty(_modulePath) && string.IsNullOrEmpty(_moduleIdentifier)) + { + var menuKeyOption = 'A'; + //Load Every Module within the specified Folder by scanning for .MDF files (with the file name of the MDF being the module identifier) + foreach (var file in Directory.GetFiles(_modulePath, "*.MDF")) + { + var moduleIdentifier = Path.GetFileNameWithoutExtension(file); + _moduleConfigurations.Add(new ModuleConfiguration { ModuleIdentifier = moduleIdentifier, ModulePath = _modulePath, ModuleEnabled = true, MenuOptionKey = menuKeyOption.ToString()}); + menuKeyOption++; + } + + } + else if (!string.IsNullOrEmpty(_moduleIdentifier)) { _menuOptionKey ??= "A";