This is my current code;
        static void Adonis()
        {
            Console.Write("adonis@" + prefix + "# ");
            string adonisInput = Console.ReadLine();
            CmdCheck(adonisInput);
        }
        static void CmdCheck(string arg)
        {
            if (arg.Contains("use"))
            {
                string str = arg;
                string[] tokens = str.Split(' ');
                string chosenExploit = tokens[1];
                if (chosenExploit == "pscan")
                {
                    p(pscan.print());
                    Adonis();
                }
                if (chosenExploit == "ping")
                {
                    //code
                }
                if (!(chosenExploit is module)) // this line keeps getting the error
                {
                    p("Invalid Syntax: '" + arg + "', 'use <arg>'; missing argument.");
                    Adonis();
                }
            }
            Console.WriteLine("Unknown command, '" + arg + "', type 'help' for more commands.");
            Adonis();
        }
Let me put some background knowledge into my initiative.
I have two objects named "pscan", and "ping". If they want to use pscan or ping, they should be able to type, "use pscan", or "use ping". I do this by finding the split in between "use" and the input, and I read the following text. Which could possibly be "pscan, or "ping".
I wanted to make some error handling, so I was trying to see like, what if someone entered something like "use", "use ", or even mispell such as "use pscna". I wanted it to read "pscna" or the null ("") and return it and tell the user that they are missing an argument and that it's an invalid syntax.
The error I keep getting is "Index was outside the bounds of the array".
 
    