Exemple #1
0
        public void Run(string input, Users user)
        {
            string[] temp = ParseReg(input);
            if (temp.Length == 0 ||
                Array.Exists(temp, element => element == "-help") ||
                Array.Exists(temp, element => element == "/help") ||
                Array.Exists(temp, element => element == "/?")
                )
            {
                ShowHelp();
            }
            else
            {
                for (int i = 0; i < temp.Length; i++)
                {
                    switch (temp[i])
                    {
                        case "-k":
                            MakeDict(temp[i + 1]);
                            i++;
                            break;

                        case "-print":
                            MakePrint(temp[i + 1]);
                            i++;
                            break;

                        case "-ping":
                            MakePing();
                            break;

                        case "-setuser":
                            user.SetUser(temp[i + 1]);
                            i++;
                            break;

                        case "-getuser":
                            user.GetUser();
                            break;

                        case "exit":
                            Environment.Exit(0);
                            break;

                        default:
                            ErrorArgs(temp[i].Trim());
                            break;
                    }
                    Console.WriteLine(new string('-', 30));
                }
            }
        }