MCSharp.Server.ParseInput C# (CSharp) Method

ParseInput() public method

public ParseInput ( string input ) : void
input string
return void
        public void ParseInput(string input)
        {
            if (input.Length > 0)
            {
                if (input[0] != '/')
                {
                    Player.GlobalMessage("[Console]: &f" + input);
                    Logger.Log(input, LogType.GlobalChat);
                }
                else
                {
                    input = input.Substring(1).Trim();
                    string cmd;
                    string[] splitInput;
                    string msg;
                    string output = "";

                    splitInput = input.Split(' ');
                    cmd = splitInput[0];
                    if (splitInput.Length > 1)
                        msg = input.Substring(input.IndexOf(' ')).Trim();
                    else
                        msg = "";
                    try
                    {
                        switch (cmd)
                        {
                            case "help":
                                output = "Commands that the console can use: \n";
                                try
                                {
                                    foreach (Command command in Command.all.All())
                                    {
                                        if (command.ConsoleSupport)
                                        {
                                            output += "/" + command.Name + ", ";
                                        }
                                    }
                                    Logger.Log(output, LogType.ConsoleOutput);
                                }
                                catch (Exception e)
                                {
                                    Logger.Log(e.Message, LogType.ErrorMessage);
                                }
                                output = output.Remove(output.Length - 2);
                                break;
                            default:
                                Command runCmd = Command.all.Find(cmd);
                                if (runCmd != null)
                                {
                                    if (runCmd.ConsoleSupport)
                                    {
                                        Logger.Log("/" + input, LogType.ConsoleOutput);
                                        runCmd.Use(msg);
                                    }
                                    else
                                    {
                                        Logger.Log("This command is not supported by the console!", LogType.ConsoleOutput);
                                    }
                                }
                                else
                                {
                                    Logger.Log("No such command!", LogType.ConsoleOutput);
                                }
                                break;
                        }
                    }
                    catch (Exception e)
                    {
                        Logger.Log(e.Message, LogType.ErrorMessage);
                    }
                    //Thread.Sleep(10);

                }
            }
        }

Same methods

Server::ParseInput ( ) : void