Esempio n. 1
0
 public void Copy(string dest)
 {
     if (dest.Contains(Path))
     {
         MessageView.FolderCopyError(Path);
         return;
     }
     try
     {
         DirectoryInfo currentDirectory = new DirectoryInfo(Path);
         dest = dest + @"\" + Name;
         if (!Directory.Exists(dest))
             Directory.CreateDirectory(dest);
         foreach (DirectoryInfo dir in currentDirectory.GetDirectories())
         {
             if (!Directory.Exists(dest + @"\" + dir.Name))
                 Directory.CreateDirectory(dest + @"\" + dir.Name);
             Folder currentFolder = new Folder(dir.Name, dir.FullName, null);
             currentFolder.Copy(dest);
         }
         foreach (FileInfo file in currentDirectory.GetFiles())
         {
             File currentFile = new File(System.IO.Path.GetFileNameWithoutExtension(file.Name),
                 file.FullName, file.Extension, file.Length, null);
             currentFile.Copy(dest);
         }
     }
     catch (IOException)
     {
         MessageView.FolderCopyError(Path);
     }
 }
Esempio n. 2
0
 public void CopyClipboard(string[] elements, string dest)
 {
     if (OpenedElement == null || elements == null)
         return;
     foreach (string element in elements)
     {
         if(Directory.Exists(element))
         {
             Folder currentFolder = new Folder(Path.GetFileName(element), element, null);
             currentFolder.Copy(dest);
         }
         else if (System.IO.File.Exists(element))
         {
             FileInfo file = new FileInfo(element);
             File currentFile = new File(Path.GetFileNameWithoutExtension(file.Name),
                 file.FullName, file.Extension, file.Length, null);
             currentFile.Copy(dest);
         }
     }
 }