Exemplo n.º 1
0
 /// <summary>
 /// Get items in directory and it's upper directory
 /// </summary>
 private void GetItems()
 {
     if (currFilesView == FilesViewL)
     {
         directoriesL = dirL.GetDirectories();
         filesL       = dirL.GetFiles();
         upDirL       = dirL.GetUpperDirectory();
     }
     else
     {
         directoriesR = dirR.GetDirectories();
         filesR       = dirR.GetFiles();
         upDirR       = dirR.GetUpperDirectory();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Copies directories recursively with their files
        /// </summary>
        /// <param name="destDirPath">Destination path</param>
        /// <param name="dir">Currently copied directory</param>
        private void PasteDiscItem(string destDirPath, DirectoryItem dir)
        {
            List <DirectoryItem> dirs  = dir.GetDirectories();
            List <FileItem>      files = dir.GetFiles();

            foreach (FileItem file in files)
            {
                if (!File.Exists(Path.Combine(destDirPath, file.Name)))
                {
                    File.Copy(file.Path, Path.Combine(destDirPath, file.Name));
                }
            }
            foreach (DirectoryItem directory in dirs)
            {
                if (!Directory.Exists(Path.Combine(destDirPath, directory.Name)))
                {
                    Directory.CreateDirectory(Path.Combine(destDirPath, directory.Name));
                }
                PasteDiscItem(Path.Combine(destDirPath, directory.Name), directory as DirectoryItem);
            }
        }