Esempio n. 1
0
    // handle new command from input box
    void CommandLine(string _Command)
    {
        string Result     = string.Empty;
        string CmdKeyword = string.Empty;

        string Command = _Command.Trim().ToLower();

        string[] Words = Command.Split(' ');

        // use first word as command identifier
        if (Words.Length > 0)
        {
            CmdKeyword = Words[0];

            ConsoleCmdBase Cmd = CommandObjects.FindByName(CmdKeyword);

            if (null != Cmd)
            {
                Result = Cmd.ProceedCommand(Words);
            }
        }

        // output section

        AddLine(">" + Command, "", LineType.Console);

        if (Result != string.Empty)
        {
            AddLine(Result, "", LineType.Console);
        }
        else
        {
            AddLine("Command '" + CmdKeyword + "' not found.", "", LineType.Console);
        }
    }