public bool getContent(string path) { CurrentDirectoryContent = new List <string>(); List <string> listOfFolders; List <string> listOfFiles; try { listOfFolders = Directory.GetDirectories(path).ToList(); listOfFiles = Directory.GetFiles(path).ToList(); if (!AvaibleDrives.Contains(Path.GetFullPath(path))) { CurrentDirectoryContent.Add(".."); } CurrentDirectoryContent.AddRange(listOfFolders.Select(x => "<D>" + Path.GetFileName(x))); CurrentDirectoryContent.AddRange(listOfFiles.Select(x => Path.GetFileName(x))); CurrentPath = Path.GetFullPath(path); return(true); } catch (Exception e) { System.Console.WriteLine(e); return(false); } }
public bool getItems(string path) { WorkingDirectoryItems = new List <string>(); try { List <string> folders = Directory.GetDirectories(path).ToList(); List <string> files = Directory.GetFiles(path).ToList(); if (!AvaibleDrives.Contains(Path.GetFullPath(path))) { WorkingDirectoryItems.Add("\uD83E\uDC45"); } WorkingDirectoryItems.AddRange(folders.Select(x => "\uD83D\uDDBF" + Path.GetFileName(x))); WorkingDirectoryItems.AddRange(files.Select(x => Path.GetFileName(x))); WorkingPath = Path.GetFullPath(path); return(true); } catch (Exception e) { return(false); } }