public void StartReadingCommands() { while (true) { OutputWriter.WriteMessage($"{SessionData.currentPath}> "); string input = Console.ReadLine(); input = input.Trim(); if (input == endCommand) { break; } this.interpreter.InterpredCommand(input); } }
public static void StartReadingCommands() { OutputWriter.WriteMessage($"{SessionData.currentPath}> "); string input = Console.ReadLine(); input = input.Trim(); while (input != EndCommand) { CommandInterpreter.InterpredCommand(input); OutputWriter.WriteMessage($"{SessionData.currentPath}> "); input = Console.ReadLine(); input = input.Trim(); } }
public static void StartReadingCommands() { while (true) { OutputWriter.WriteMessage($"{SessionData.currentPath}> "); var input = Console.ReadLine(); input = input.Trim(); if (input == endCommand) { return; } CommandInterpreter.InterpredCommand(input); } }
public static void StartReadingCommands() { while (true) { OutputWriter.WriteMessage($"{SessionData.currentPath}> "); string input = Console.ReadLine(); if (input.Equals(EndCommand)) { break; } input = input.Trim(); CommandInterpreter.InterpretCommand(input); } }
public void StartReadingCommands() { OutputWriter.WriteMessage($"{SessionData.CurrentPath}>"); string input = Console.ReadLine(); input = input.Trim(); while (!input.Equals(EndCommand)) { this.interpreter.InterpredCommand(input); OutputWriter.WriteMessage($"{SessionData.CurrentPath}>"); input = Console.ReadLine(); input = input.Trim(); } }
public static void StartReadingCommands() { OutputWriter.WriteMessage($"{SessionData.currentPath}> "); var input = Console.ReadLine(); input = input.Trim(); while (input != endCommand) { //Interpret comand OutputWriter.WriteMessage($"{SessionData.currentPath}> "); input = Console.ReadLine(); input = input.Trim(); } }
/// <summary> /// Starts to listen for commands and executes them if the syntax is correct. /// </summary> public static void StartReadingCommands() { OutputWriter.WriteMessage($"{SessionData.currentPath}> "); string input = Console.ReadLine(); input = input.Trim(); // TODO: change with do-while ??? avoiding repetitions of code while (!input.Equals(endCommand)) { CommandInterpreter.InterpredComman(input); OutputWriter.WriteMessage($"{SessionData.currentPath}> "); input = Console.ReadLine(); input = input.Trim(); } }
public static void StartReadingCommands() { bool closeConsole = false; while (!closeConsole) { OutputWriter.WriteMessage($"{SessionData.currentPath}>"); string input = Console.ReadLine(); input = input.Trim(); if (input.Equals(endCommand)) { closeConsole = true; continue; } CommandInterpreter.InterpredCommand(input); } }
public static void TraverseDirectory(int depth) { OutputWriter.WriteEmptyLine(); int initialIdentation = SessionData.currentPath.Split('\\').Length; Queue <string> subfolders = new Queue <string>(); subfolders.Enqueue(SessionData.currentPath); while (subfolders.Count > 0) { string currentPath = subfolders.Dequeue(); int identation = currentPath.Split('\\').Length - initialIdentation; OutputWriter.WriteMessage(new string('-', identation)); OutputWriter.WriteMessage(currentPath); OutputWriter.WriteEmptyLine(); string folderLength = new string('-', currentPath.Length); try { foreach (var file in Directory.GetFiles(currentPath)) { var fileName = file.Split(new[] { '\\' }, StringSplitOptions.RemoveEmptyEntries).Last().ToString(); OutputWriter.WriteMessageOnNewLine(folderLength + "\\" + fileName); } foreach (var directoryPath in Directory.GetDirectories(currentPath)) { subfolders.Enqueue(directoryPath); } } catch (UnauthorizedAccessException) { OutputWriter.DisplayException(ExceptionMessages.UnauthorizedExceptionMessage); } if (identation == depth) { break; } } }
public static void StartReadingCommands() { OutputWriter.WriteMessage($"{SessionData.CurrentPath}>"); string input; while ((input = Console.ReadLine()) != EndCommand) { if (string.IsNullOrWhiteSpace(input)) { continue; } input = input.Trim(); CommandInterpreter.InterpredCommand(input); OutputWriter.WriteMessage($"{SessionData.CurrentPath}>"); } }
public static void StartReadingCommands() { while (true) { OutputWriter.WriteMessage($"{SessionData.currentPath}> "); string input = Console.ReadLine().Trim(); if (input.Equals(endCommand)) { break; } if (string.IsNullOrEmpty(input)) { input = Console.ReadLine().Trim(); continue; } CommandInterpreter.InterpredCommand(input); } }
public void StartReadingCommands() { // Reading commands until we receive the end "quit" command while (true) { OutputWriter.WriteMessage($"{SessionData.currentPath}> "); string input = Console.ReadLine().Trim(); if (input.Equals(endCommand)) { break; } if (string.IsNullOrEmpty(input)) { input = Console.ReadLine().Trim(); continue; } this.interpreter.InterpretCommand(input); } }
public static void StartReadingCommands() { OutputWriter.WriteMessage($"{SessionData.currentPath}> "); string input = Console.ReadLine(); input = input.Trim(); bool isInputQuit = false; while (!isInputQuit) { if (input == endCommand) { isInputQuit = true; break; } CommandInterpreter.InterpredCommand(input); OutputWriter.WriteMessage($"{SessionData.currentPath}> "); input = Console.ReadLine(); input = input.Trim(); } }
public static void TraverseDirectory(int depth) { OutputWriter.WriteEmptyLine(); int initialIdentation = SessionData.currentPath.Split('\\').Length; Queue <string> subFolders = new Queue <string>(); subFolders.Enqueue(SessionData.currentPath); while (subFolders.Count != 0) { string currentPath = subFolders.Dequeue(); int identation = currentPath.Split('\\').Length - initialIdentation; OutputWriter.WriteMessage(currentPath); try { foreach (var file in Directory.GetFiles(currentPath)) { int indexOfLastSlash = file.LastIndexOf("\\"); string fileName = file.Substring(indexOfLastSlash); OutputWriter.WriteMessageOnNewLIne(new string('-', indexOfLastSlash) + fileName); } foreach (var directoryPath in Directory.GetDirectories(currentPath)) { subFolders.Enqueue(directoryPath); } } catch (UnauthorizedAccessException) { OutputWriter.DisplayException(ExceptionMessages.UnauthorizedAccessExceptionMessage); } OutputWriter.WriteMessageOnNewLIne(string.Format("{0}{1}", new string('-', identation), currentPath)); if (depth - identation < 0) { break; } } }
private static void DisplayInvalidCommandMessage(string input) { OutputWriter.WriteMessage($"The command '{input}' is invalid"); }