JsonResult IDriver.Paste(string source, string dest, IEnumerable<string> targets, bool isCut)
 {
     FullPath destPath = ParsePath(dest);
     ReplaceResponse response = new ReplaceResponse();
     foreach (var item in targets)
     {
         FullPath src = ParsePath(item);
         if (src.Directory != null)
         {
             DirectoryInfo newDir = new DirectoryInfo(Path.Combine(destPath.Directory.FullName, src.Directory.Name));
             if (newDir.Exists)
                 Directory.Delete(newDir.FullName, true);
             if (isCut)
             {
                 RemoveThumbs(src);
                 src.Directory.MoveTo(newDir.FullName);
                 response.Removed.Add(item);
             }
             else
             {
                 DirectoryCopy(src.Directory, newDir.FullName, true);
             }
             response.Added.Add(DTOBase.Create(newDir, destPath.Root));
         }
         else
         {
             string newFilePath = Path.Combine(destPath.Directory.FullName, src.File.Name);
             if (File.Exists(newFilePath))
                 File.Delete(newFilePath);
             if (isCut)
             {
                 RemoveThumbs(src);
                 src.File.MoveTo(newFilePath);
                 response.Removed.Add(item);
             }
             else
             {
                 File.Copy(src.File.FullName, newFilePath);
             }
             response.Added.Add(DTOBase.Create(new FileInfo(newFilePath), destPath.Root));
         }
     }
     return Json(response);
 }
 JsonResult IDriver.Rename(string target, string name)
 {
     FullPath fullPath = ParsePath(target);
     var answer = new ReplaceResponse();
     answer.Removed.Add(target);
     RemoveThumbs(fullPath);
     if (fullPath.Directory != null)
     {
         string newPath = Path.Combine(fullPath.Directory.Parent.FullName, name);
         System.IO.Directory.Move(fullPath.Directory.FullName, newPath);
         answer.Added.Add(DTOBase.Create(new DirectoryInfo(newPath), fullPath.Root));
     }
     else
     {
         string newPath = Path.Combine(fullPath.File.DirectoryName, name);
         File.Move(fullPath.File.FullName, newPath);
         answer.Added.Add(DTOBase.Create(new FileInfo(newPath), fullPath.Root));
     }
     return Json(answer);
 }