Esempio n. 1
0
 JsonResult IDriver.Tree(string target)
 {
     FullPath fullPath = ParsePath(target);
     TreeResponse answer = new TreeResponse();
     foreach (var item in fullPath.Directory.GetDirectories())
     {
         if ((item.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden)
             answer.Tree.Add(DTOBase.Create(item, fullPath.Root));
     }
     return Json(answer);
 }
Esempio n. 2
0
 JsonResult IDriver.Parents(string target)
 {
     FullPath fullPath = ParsePath(target);
     TreeResponse answer = new TreeResponse();
     if (fullPath.Directory.FullName == fullPath.Root.Directory.FullName)
     {
         answer.Tree.Add(DTOBase.Create(fullPath.Directory, fullPath.Root)); 
     }
     else
     {
         DirectoryInfo parent = fullPath.Directory;
         foreach (var item in parent.Parent.GetDirectories())
         {
             answer.Tree.Add(DTOBase.Create(item, fullPath.Root));
         }
         while (parent.FullName != fullPath.Root.Directory.FullName)
         {
             parent = parent.Parent;
             answer.Tree.Add(DTOBase.Create(parent, fullPath.Root));
         }
     }
     return Json(answer);
 }