Hello, today I release my advanced command list, which is great to manage commands from a configuration file. I didn't made the configuration loader + adder, but I made the rest.
First, add this:
Second, add some values. Insert into the first string the name of the command the user must type. Insert into the second string the name of the method/void to invoke.Code:static Dictionary<string, string> Commands = new Dictionary<string, string>();
Third, make a new void (with parameter 'string Input') and add:
Fourth, in your main bootup add this: (Program.cs Main void)Code:if (Commands.ContainsKey(Input)) { Type mType = typeof(Programma); string Method = Commands[Input]; mType.GetMethod(Method).Invoke(null, null); } else { Console.WriteLine("Sorry, the command {0} isn't found in the dictionary.", Input); }
It works :)Code:while (true) { NAME OF YOUR METHOD(Console.ReadLine()); }
I'll make the configuration adder in a few minutes and will release it.





