public override void Execute(IOutputter outputter) { List <FileSystemItem> content = dirToPrint.Content; outputter.PrintLine("Directory of " + dirToPrint.Path); outputter.NewLine(); foreach (FileSystemItem item in content) { if (item.IsDirectory()) { outputter.Print("<DIR>"); } else { outputter.Print("" + item.GetSize()); } outputter.Print("\t" + item.Name); outputter.NewLine(); } outputter.PrintLine("\t" + dirToPrint.GetNumberOfFiles() + " File(s)"); outputter.PrintLine("\t" + dirToPrint.GetNumberOfDirectories() + " Dir(s)"); }
public override void Execute(IOutputter outputter) { if (GetParameterCount() > 0) { string fileName = GetParameterAt(0); string fileContent = GetContent(fileName, Drive.CurrentDirectory); string timeStamp = GetTimeStamp(fileName, Drive.CurrentDirectory); if (GetParameterCount() == 3 && GetParameterAt(2).Equals("/y", StringComparison.InvariantCultureIgnoreCase)) { File DelFile = new File(fileName, null, null); this.destinationDirectory.Del(DelFile); File CopyFile = new File(fileName, fileContent, timeStamp); this.destinationDirectory.Add(CopyFile, true); outputter.Print("Copy File " + fileName + " is Succeed Replace"); outputter.NewLine(); } else { File CopyFile = new File(fileName, fileContent, timeStamp); this.destinationDirectory.Add(CopyFile, false); outputter.Print("Copy File " + fileName + " is Succeed"); outputter.NewLine(); } } else { outputter.PrintLine(VER_IS_INVALID); } }
/// <summary> /// Processes input from the console and invokes the invoker until 'exit' is typed. /// </summary> public void ProcessInput() { string line = string.Empty; outputter.PrintLine("Zühlke Agile Course [Version 19.1.2010]"); outputter.PrintLine("(C) Copyright 2006-2010 Rainer Grau and Daniel Tobler."); while (line.Trim().Equals("exit", StringComparison.OrdinalIgnoreCase) == false) { int readChar = 0; var input = new StringBuilder(); outputter.NewLine(); outputter.Print(drive.Prompt); try { while (readChar != '\n') { readChar = System.Console.Read(); input.Append((char)readChar); } line = input.ToString(); } catch (IOException) { // do nothing by intention } invoker.ExecuteCommand(line, outputter); } outputter.PrintLine("\nGoodbye!"); drive.Save(); }
private static void PrintContent(IEnumerable <FileSystemItem> directoryContent, IOutputter outputter) { foreach (FileSystemItem item in directoryContent) { if (item.IsDirectory()) { outputter.Print("<DIR>"); } else { outputter.Print("" + item.GetSize()); } outputter.Print("\t" + item.Name); outputter.NewLine(); } }
private static void PrintContent(IEnumerable <FileSystemItem> directoryContent, string name, IOutputter outputter) { foreach (FileSystemItem item in directoryContent) { if (item.Name == name) { outputter.Print(item.FileContent()); } } }
public override void Execute(IOutputter outputter) { if (GetParameterCount() > 0) { string fileName = GetParameterAt(0).Substring(GetParameterAt(0).LastIndexOf("\\") + 1); File DelFile = new File(fileName, null, null); this.destinationDirectory.Del(DelFile); outputter.Print("File " + fileName + " is Deleted"); outputter.NewLine(); } else { outputter.PrintLine(VER_IS_INVALID); } }
/// <summary> /// Processes input from the console and invokes the invoker until 'exit' is typed. /// </summary> public void ProcessInput() { string line = string.Empty; outputter.PrintLine("DOSBox, Scrum.org, Professional Scrum Developer Training"); outputter.PrintLine("Copyright (c) Rainer Grau and Daniel Tobler. All rights reserved."); while (line.Trim().Equals("exit", StringComparison.OrdinalIgnoreCase) == false) { int readChar = 0; var input = new StringBuilder(); outputter.NewLine(); outputter.Print(drive.Prompt); try { while (readChar != '\n') { readChar = System.Console.Read(); input.Append((char)readChar); } line = input.ToString(); } catch (IOException) { // do nothing by intention } outputter.ResetStatistics(); invoker.ExecuteCommand(line, outputter); } outputter.PrintLine("\nGoodbye!"); drive.Save(); }
public void HasCharactersPrinted_PrintAString_IsTrue() { outputter.Print("a text"); Assert.IsTrue(outputter.HasCharactersPrinted()); Assert.AreEqual(6, outputter.NumberOfCharactersPrinted()); }