public void Execute() { do { Console.WriteLine("\nDo you want to have the detail of a folder (Y/N)?"); var answer = Console.ReadLine(); if (answer.ToUpper() == "Y") { try { Console.WriteLine("\nWhat is the folder you would like to inspect ?"); var path = Console.ReadLine(); FolderDetail detail = reader.GetFolderDetail(path); Console.WriteLine(detail.ToString()); } catch (Exception ex) { Console.WriteLine("Une erreur est survenue: {0}", ex.Message); } } else if (answer.ToUpper() == "N") { break; } } while (true); }
private int PrintFolders(string folderPath) { var dirInfo = new DirectoryInfo(folderPath); var folderCount = 0; foreach (var directoryInfo in dirInfo.GetDirectories()) { var folderDetail = new FolderDetail(directoryInfo, folderDelimiterToolStripMenuItem.Checked); outputTextBox.PrintLine(folderDetail.ToString()); folderCount++; } return(folderCount); }