Exemplo n.º 1
0
 public string getPathFromParent(FileDirectory fd, string path)
 {
     if (fd.getParent() != null)
     {
         path = this.getPathFromParent(fd.getParent(), fd.getParent().getPath()) + "\\" + path;
     }
     return path;
 }
Exemplo n.º 2
0
 private List<FileDirectory> getChildrenOf(FileDirectory fd, string path, string filepattern)
 {
     List<FileDirectory> list = new List<FileDirectory>();
     if (fd.getParent() != null){
         path = this.getPathFromParent(fd, path);
     }
     if (Directory.Exists(path)) {
         try{
             foreach( string s in Directory.GetDirectories(path)){
                 if (directoryHasFilePattern(s, filepattern)) {
                     list.Add(new FileDirectory(new DirectoryInfo(s).Name, fd));
                 }
             }
         }
         catch (UnauthorizedAccessException){
             Console.Out.WriteLine(HelperErrors.UNAUTHORISED_DIRECTORY_ACCESS + path);
         }
     }
     return list;
 }