Fixed error where the function would produce wrong commands

This commit is contained in:
Lukasz Baldyga committed 2020-10-21 13:39:00 +01:00
1 parent 508ed53f09
commit 4124f6d7d6
1 file changed
+8 -3
@@ -76,6 +76,11 @@ namespace Advanced_Software_Engineering {
return int.Parse(text); return int.Parse(text);
} }
public static double ConvertToDouble(string text) {
text = Strip(text);
return double.Parse(text);
}
public static List<string> StripStringArray(string[] array) { public static List<string> StripStringArray(string[] array) {
List<string> newStringList = new List<string>(); List<string> newStringList = new List<string>();
@@ -94,15 +99,15 @@ namespace Advanced_Software_Engineering {
//split the command from the parameters //split the command from the parameters
string[] parameters = Strip(text).Split(new char[] { " "[0] }, 2); string[] parameters = Strip(text).Split(new char[] { " "[0] }, 2);
//Check there is content //There are parameters, make the command
if (parameters.Length > 0) { if (parameters.Length > 0) {
//set command var //set command var
string command = Strip(parameters[0]); string command = Strip(parameters[0]);
commandAndParameters["command"] = new string[] { command }; commandAndParameters["command"] = new string[] { command };
} }
//If there is nothing split after the first split, why bother doing anything? //There is at least one parameter
else if (parameters.Length > 1) { if (parameters.Length > 1) {
//seperate all of the parameters by a comma //seperate all of the parameters by a comma
parameters = parameters[1].Split(","[0]); parameters = parameters[1].Split(","[0]);