public void Copy(IFileSystem source, FileSystemPath sourcePath, IFileSystem destination, FileSystemPath destinationPath)
        {
            var pSource          = (PhysicalFileSystem)source;
            var pDestination     = (PhysicalFileSystem)destination;
            var pSourcePath      = pSource.GetPhysicalPath(sourcePath);
            var pDestinationPath = pDestination.GetPhysicalPath(destinationPath);

            if (sourcePath.IsFile)
            {
                System.IO.File.Copy(pSourcePath, pDestinationPath);
            }
            else
            {
                destination.CreateDirectory(destinationPath);
                foreach (var e in source.GetEntities(sourcePath))
                {
                    source.Copy(e, destination, e.IsFile ? destinationPath.AppendFile(e.EntityName) : destinationPath.AppendDirectory(e.EntityName));
                }
            }
        }
        public void Move(IFileSystem source, FileSystemPath sourcePath, IFileSystem destination, FileSystemPath destinationPath)
        {
            var pSource          = (PhysicalFileSystem)source;
            var pDestination     = (PhysicalFileSystem)destination;
            var pSourcePath      = pSource.GetPhysicalPath(sourcePath);
            var pDestinationPath = pDestination.GetPhysicalPath(destinationPath);

            if (sourcePath.IsFile)
            {
                System.IO.File.Move(pSourcePath, pDestinationPath);
            }
            else
            {
                System.IO.Directory.Move(pSourcePath, pDestinationPath);
            }
        }
Exemple #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 public FileSystemEntity(IFileSystem fileSystem, FileSystemPath path)
 {
     this.FileSystem = fileSystem;
     this.Path       = path;
 }