Exemplo n.º 1
0
        public void ExecuteCommand(string command)
        {
            string[] commandSplit = command.Split(new char[] { ' ' }, 2);
            switch (commandSplit[0])
            {
            case "ls":
                Service.ListDirectories(currentPath).ForEach(x => SendToClient(x));
                break;

            case "cd":
                currentPath = Service.ChangeDirectory(currentPath, commandSplit[1]);
                break;

            case "mkdir":
                Service.MakeDirectory(currentPath + commandSplit[1]);
                break;

            case "rm":
                SendToClient(Service.RemoveDirectory(currentPath + commandSplit[1]));
                break;

            default:
                SendToClient("Invalid command!");
                break;
            }
        }