From 6e3cfb01cc1f73de3ad04494f118e24e9056a131 Mon Sep 17 00:00:00 2001 From: Lukasz Baldyga Date: Mon, 2 Nov 2020 15:40:50 +0000 Subject: [PATCH] Added documentation to undocumented functions --- .../SettingsAndHelperFunctions.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Advanced Software Engineering/Advanced Software Engineering/SettingsAndHelperFunctions.cs b/Advanced Software Engineering/Advanced Software Engineering/SettingsAndHelperFunctions.cs index 4c5d7c6..3560ef7 100644 --- a/Advanced Software Engineering/Advanced Software Engineering/SettingsAndHelperFunctions.cs +++ b/Advanced Software Engineering/Advanced Software Engineering/SettingsAndHelperFunctions.cs @@ -74,6 +74,15 @@ namespace Advanced_Software_Engineering { } + /// + /// Strips the strings of the full array. See + /// + /// + /// string[] tmp = {" text ", " ", " with", "spaces ", ""}; + /// Console.WriteLine(StripStringArray(tmp)); // => {"text", "with", "spaces"} + /// + /// Dirty array with spaces + /// A stripped aray public static List StripStringArray(string[] array) { List newStringList = new List(); @@ -86,6 +95,11 @@ namespace Advanced_Software_Engineering { return newStringList; } + /// + /// Parses the commands into a directry that Commander can use. See + /// + /// A string command + /// Directory with the command and its parameters cleanly separated public static Dictionary CommandAndParameterParser(string text) { Dictionary commandAndParameters = new Dictionary(); @@ -93,7 +107,7 @@ namespace Advanced_Software_Engineering { string prepParameters = Strip(text); if (prepParameters.Length == 0) return commandAndParameters; - //split the command from the parameters + //split the command from the parameters string[] parameters = prepParameters.Split(new char[] { " "[0] }, 2); //There are parameters, make the command @@ -103,7 +117,7 @@ namespace Advanced_Software_Engineering { commandAndParameters["command"] = new string[] { command }; } - //There is at least one parameter + //There is at least one parameter if (parameters.Length > 1) { //seperate all of the parameters by a comma parameters = parameters[1].Split(","[0]);