Beispiel #1
0
 private void dl(Command c)
 {
     if (c.getArgs() == null || c.getArgs().Length != 2)
     {
         Console.WriteLine("Usage: dl <remote file> <local file>");
     }
     else
     {
         string remote = c.getArgs()[0].Replace(" ", "%20");
         string local = c.getArgs()[1];
         Console.WriteLine("Downloading " + remote + " to " + local);
         ftp.download(remote, local);
         //Console.WriteLine("I'd download that file if I was implemented yet.");
     }
 }
Beispiel #2
0
 private void ls(Command c)
 {
     if (c.getArgs() == null || c.getArgs().Length != 1)
     {
         Console.WriteLine("Usage: ls <directory path>");
     }
     else
     {
         Console.WriteLine(c.getArgs()[0]);
         Console.WriteLine(
             ftp.pwdSimple(c.getArgs()[0])
             );
     }
 }
Beispiel #3
0
 private void ul(Command c)
 {
     if (c.getArgs() == null || c.getArgs().Length != 2)
     {
         Console.WriteLine("Usage: ul <local file> <remote file>");
     }
     else
     {
         Console.WriteLine("I'd upload that file if I was implemented yet.");
     }
 }
Beispiel #4
0
 private void autodl(Command c)
 {
     Console.WriteLine("Oh God, that's not even close to done yet.");
 }
Beispiel #5
0
 private void rm(Command c)
 {
     if(c.getArgs() == null || c.getArgs().Length != 1)
     {
         Console.WriteLine("Usage: rm <remote file>");
     }
     else
     {
         Console.WriteLine("I'd remove that file if I was implemented yet.");
     }
 }
Beispiel #6
0
 private bool quit(Command c)
 {
     if (c.getArgs() != null)
     {
         Console.WriteLine("Quit what?");
         return false;
     }
     return true;
 }
Beispiel #7
0
        private bool processCommand(Command command)
        {
            bool end = false;

            if (command.isUnknown())
            {
                Console.WriteLine("Do what now?");
                return false;
            }

            string commandWord = command.getCommand();
            switch (commandWord)
            {
                case "ls": ls(command); break;
                case "lsd": lsd(command); break;
                case "help": help(); break;
                case "quit": end = quit(command); break;
                case "dl": dl(command); break;
                case "ul": ul(command); break;
                case "rm": rm(command); break;
                case "mkdir": mkdir(command); break;
                case "mv": mv(command); break;
                case "autodl": autodl(command); break;
                case "cls": cls(); break;
                default:
                    Console.WriteLine("Do what now?");
                    break;
            }
            return end;
        }
Beispiel #8
0
 private void mv(Command c)
 {
     if (c.getArgs() == null || c.getArgs().Length != 2)
     {
         Console.WriteLine("Usage: mv <old filename> <new filename>");
     }
     else
     {
         Console.WriteLine("I'd rename that file if I was implemented yet.");
     }
 }
Beispiel #9
0
 private void mkdir(Command c)
 {
     if(c.getArgs() == null || c.getArgs().Length != 1)
     {
         Console.WriteLine("Usage: mkdir <remote directory>");
     }
     else
     {
         Console.WriteLine("I'd make that directory if I was implemented yet.");
     }
 }