From 4fe279d9d73ad5807cc7fba486ebb00a4dfc857b Mon Sep 17 00:00:00 2001 From: Chomp Date: Wed, 25 Aug 2021 19:10:29 +0100 Subject: [PATCH] refactoring of code for readability --- PMCGenerator/Program.cs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/PMCGenerator/Program.cs b/PMCGenerator/Program.cs index 2c0c15c..de7ff65 100644 --- a/PMCGenerator/Program.cs +++ b/PMCGenerator/Program.cs @@ -13,14 +13,9 @@ namespace PMCGenerator { static void Main(string[] args) { - var itemLibrary = GetItemLibraryFileAndParse(); + var itemLibrary = GetItemLibrary(); - var presetPath = CreateInputFolder("presets"); - - var presetFiles = GetPresetFileList(presetPath); - - // Parse into list of strongly typed objects - var parsedPresets = ParsePresetJsons(presetFiles); + var parsedPresets = GetPresets(); // Create flat lists of weapons + list of mods var flatPrimaryWeaponsList = GetWeaponsFromRawFile(parsedPresets); @@ -114,7 +109,10 @@ namespace PMCGenerator CreateJsonFile(outputPath, outputJson); } - private static Dictionary GetItemLibraryFileAndParse() + /// + /// Get a strongly typed dictionary of BSGs items library + /// + private static Dictionary GetItemLibrary() { CreateInputFolder(string.Empty); @@ -140,8 +138,14 @@ namespace PMCGenerator }; } - private static List ParsePresetJsons(List presetFiles) + /// + /// Get a list of all the presets in the input/presets folder and return as a list of strongly typed objects + /// + private static List GetPresets() { + var presetPath = CreateInputFolder("presets"); + var presetFiles = GetPresetFileList(presetPath); + var result = new List(); foreach (var presetFile in presetFiles) {