private void OpenFile(string targetFilePath) { NetworkSystem.File targetFile = currentPC.FindFile(targetFilePath); if (targetFile == null) { FileNotFound(targetFilePath); } else { if (targetFile.isDirectory == false) { switch (targetFile.fileContent) { case "/": response.Add(terminal.ColorString("Error", Color.red) + ": the file is corrupted beyond recovery."); break; case "": break; default: PrintFile(targetFile.fileContent); break; } } else { IncorrectCommandSyntax("cat", terminal.ColorString(currentPC.GetFilePath(targetFile), Color.blue) + " is not a file."); } } }
private void ChangeDirectory(string targetDirectoryPath) { NetworkSystem.File targetDirectory = currentPC.FindFile(targetDirectoryPath); if (targetDirectory == null) { FileNotFound(targetDirectoryPath); } else { if (targetDirectory.isDirectory) { currentPC.workingDirectory = targetDirectory; this.workingDirectory = currentPC.workingDirectory.fileName; } else { IncorrectCommandSyntax("cd", terminal.ColorString(currentPC.GetFilePath(targetDirectory), Color.blue) + " is not a directory."); } } }