public static void TryChangeDirRelative(string input, string[] data) { if (data.Length == 2) { string dir = data[1]; IOManager.ChangeCurrentDirectoryRelative(dir); } }
private static void TryChangePathRelatively(string input, string[] data) { if (!IsDataValid(data, 2)) { return; } var relPath = data[1]; IOManager.ChangeCurrentDirectoryRelative(relPath); }
private static void TryChangePathRelatively(string input, string[] data) { if (data.Length == 2) { string relPath = data[1]; IOManager.ChangeCurrentDirectoryRelative(relPath); } else { DisplayInvalidCommandMessage(input); } }
public static void Main() { //IOManager.ChangeCurrentDirectoryAbsolute(@"C:\Windows"); //IOManager.TraverseDirectory(20); //IOManager.CreateDirectoryInCurrentFolder("veso"); IOManager.ChangeCurrentDirectoryRelative(".."); IOManager.ChangeCurrentDirectoryRelative(".."); IOManager.ChangeCurrentDirectoryRelative(".."); IOManager.ChangeCurrentDirectoryRelative(".."); IOManager.ChangeCurrentDirectoryRelative(".."); IOManager.ChangeCurrentDirectoryRelative(".."); IOManager.ChangeCurrentDirectoryRelative(".."); IOManager.ChangeCurrentDirectoryRelative(".."); IOManager.ChangeCurrentDirectoryRelative(".."); }
private static void TryChangePathRelatively(string input, string[] data) { string relPath = data[1]; IOManager.ChangeCurrentDirectoryRelative(relPath); }
private static void ChangeDirectoryRelative(List <string> commandParameters) { string relativePath = commandParameters[0]; IOManager.ChangeCurrentDirectoryRelative(relativePath); }
public static void InterpredCommand(string input) { string[] data = input.Split(' '); string command = data[0]; int indexOfFirstSpace = input.IndexOf(' '); string inputAfterCommand = input.Substring(indexOfFirstSpace + 1); switch (command) { case "mkdir": if (data.Length == 2) { IOManager.CreateDirectoryInCurrentFolder(data[1]); } else { OutputWriter.DisplayException(ExceptionMessages.InvalidCommandParams); } break; case "ls": if (data.Length == 1) { IOManager.ShowDirectory(); } else { OutputWriter.DisplayException(command + ExceptionMessages.UnNeededParameters); } break; case "clear": if (data.Length == 1) { Console.Clear(); } else { OutputWriter.DisplayException(command + ExceptionMessages.UnNeededParameters); } break; case "cd": if (data.Length >= 2) { IOManager.ChangeCurrentDirectoryRelative(inputAfterCommand); } else { OutputWriter.DisplayException(command + ExceptionMessages.InvalidCommandParams); } break; case "readDb": StudentsRepository.InitializeData(inputAfterCommand); break; case "filter": if (data.Length == 2) { StudentsRepository.GetAllStudentsFromCourse(data[1]); } break; case "download": if (data.Length > 1) { IOManager.DownloadFile(inputAfterCommand); } else { OutputWriter.DisplayException(ExceptionMessages.MissingURL); } break; case "open": if (data.Length == 2) { IOManager.OpenFile(data[1]); } else { OutputWriter.DisplayException(ExceptionMessages.MissingURL); } break; case "help": if (data.Length == 1) { IOManager.Help(); } else { OutputWriter.DisplayException(command + ExceptionMessages.UnNeededParameters); } break; case "s": if (data.Length == 2) { PremiumMobileRepository.SummarizeEmails(data[1]); } break; default: OutputWriter.DisplayException(ExceptionMessages.InvalidCommand); break; } }