예제 #1
0
        public bool Copy(DiskOprationInfo copyInfo)
        {
            //if (copyInfo.DestinationPath[0] != '~')
            //    copyInfo.DestinationPath = copyInfo.DestinationPath[0] == '/' ? "~" + copyInfo.DestinationPath : "~/" + copyInfo.DestinationPath;
            //if (copyInfo.SourcePath[0] != '~')
            //    copyInfo.SourcePath = copyInfo.SourcePath[0] == '/' ? "~" + copyInfo.SourcePath : "~/" + copyInfo.SourcePath;

            var destinationPath = AuthorizeManager.AuthorizeActionOnPath(copyInfo.DestinationPath, ActionKey.WriteToDisk);
            var sourcePath      = AuthorizeManager.AuthorizeActionOnPath(copyInfo.SourcePath, ActionKey.ReadFromDisk);

            Parallel.ForEach(copyInfo.Files, file =>
            {
                _fileSystemManager.CopyFile(sourcePath + "/" + file, destinationPath + "/" + file, copyInfo.OverWrite);
            });
            Parallel.ForEach(copyInfo.Folders, folder =>
            {
                _fileSystemManager.CopyDirectory(sourcePath + "/" + folder, destinationPath + "/" + folder, copyInfo.OverWrite);
            });
            return(true);
        }