/// <summary> /// Gets the variables needed from the user to create a FTP object /// </summary> public static void GetStartVariables() { if (File.Exists("Credentials")) { CredentialsHandling.LoadCredentials(); } else { Console.Write("Username = "******"Password = "******"FTP Server = "); string ftpServer = Console.ReadLine(); Program.ftpServer = ftpServer; }
static void CMD() { // Declare variable string cmd; // Get it. Console.Write(username + "@" + ftpServer + " $"); cmd = Console.ReadLine(); // Log the command if logging is enabled Check(true, cmd); switch (cmd.ToLower()) { // FTP commands case "upload file": UserInteraction.GetVariablesForUploadFile(false); break; case "upload file -silent": UserInteraction.GetVariablesForUploadFile(true); break; case "download file": UserInteraction.GetVariablesForDownloadFile(false); break; case "download file -silent": UserInteraction.GetVariablesForDownloadFile(true); break; case "download all files in dir": UserInteraction.DownloadAllFilesInDir(false); break; case "download all files in dir -silent": UserInteraction.DownloadAllFilesInDir(true); break; case "get files in dir": UserInteraction.PrintAllFilesInDir(false); break; case "get files in dir -silent": UserInteraction.PrintAllFilesInDir(true); break; case "upload folder": UserInteraction.UploadLocalFolder(false); break; case "upload folder -silent": UserInteraction.UploadLocalFolder(true); break; // Credentials commands case "save credentials": CredentialsHandling.SaveCredentials(); break; case "load credentials": CredentialsHandling.LoadCredentials(); break; // Logging commands case "enable logging": Logging = true; Console.WriteLine("Logging is now enabled."); break; case "disable logging": Logging = false; Console.WriteLine("Logging is now disabled"); break; case "write log to file": Log.WriteLogToFile(); break; // Main Commands case "help": UserInteraction.Help(); break; case "exit": UserInteraction.Exit(); break; case "quit": Log.WriteLogToFile(); System.Threading.Thread.Sleep(500); Environment.Exit(0); break; default: Console.WriteLine("Woops, command not found."); break; } }