Пример #1
0
        public void Paste(ListView list, bool left)
        {
            string currentPath;

            if (left)
            {
                currentPath = currentPath1;
            }
            else
            {
                currentPath = currentPath2;
            }
            if (foldersToCopy.Count > 0)
            {
                for (int i = 0; i < foldersToCopy.Count; i++)
                {
                    if (Presenter.IsSubDirectory(foldersToCopy[i].Path, currentPath))
                    {
                        throw new IOException();
                    }
                    if (!Directory.Exists(currentPath + "\\" + foldersToCopy[i].Name))
                    {
                        foldersToCopy[i].Copy(currentPath);
                        director.CopyReport(foldersToCopy[i].Path, currentPath + "\\" + foldersToCopy[i].Name);
                        director.BuildReport();
                        reports.Add(director.GetReportItem());
                    }
                    else
                    {
                        MessageBox.Show("The folder is already exists", "Error");
                    }
                }
            }
            if (filesToCopy.Count > 0)
            {
                for (int i = 0; i < filesToCopy.Count; i++)
                {
                    if (!File.Exists(currentPath + "\\" + filesToCopy[i].Name))
                    {
                        filesToCopy[i].Copy(currentPath);
                        director.CopyReport(filesToCopy[i].Path, currentPath + "\\" + filesToCopy[i].Name);
                        director.BuildReport();
                        reports.Add(director.GetReportItem());
                    }
                    else
                    {
                        MessageBox.Show("The file is already exists", "Error");
                    }
                }
            }
        }
Пример #2
0
        public void Paste(ListView list, bool left)
        {
            string CurrentPath;

            if (left)
            {
                CurrentPath = currentPath1;
            }
            else
            {
                CurrentPath = currentPath2;
            }
            if (foldersToCopy.Count > 0)
            {
                for (int i = 0; i < foldersToCopy.Count; i++)
                {
                    if (Presenter.IsSubDirectory(foldersToCopy[i].Path, CurrentPath))
                    {
                        throw new IOException();
                    }
                    if (!Directory.Exists(CurrentPath + "\\" + foldersToCopy[i].Name))
                    {
                        foldersToCopy[i].Copy(CurrentPath);
                    }
                }
            }
            if (filesToCopy.Count > 0)
            {
                for (int i = 0; i < filesToCopy.Count; i++)
                {
                    if (!File.Exists(CurrentPath + "\\" + filesToCopy[i].Name))
                    {
                        filesToCopy[i].Copy(CurrentPath);
                    }
                }
            }
        }