示例#1
0
        public static ICollection <FileSystemEntity> GetEntities(this Directory directory)
        {
            var paths = directory.GetEntityPaths();

            return(new EnumerableCollection <FileSystemEntity>(
                       paths.Select(p => FileSystemEntity.Create(directory.FileSystem, p)), paths.Count));
        }
 public static void MoveTo(this FileSystemEntity entity, IFileSystem destinationFileSystem, FileSystemPath destinationPath)
 {
     entity.FileSystem.Move(entity.Path, destinationFileSystem, destinationPath);
 }
 public static void Delete(this FileSystemEntity entity)
 {
     entity.FileSystem.Delete(entity.Path);
 }
 /// <summary>
 /// Copies this entity to a destination file system (async with cancellation token).
 /// </summary>
 public static Task CopyToAsync(this FileSystemEntity entity, IFileSystem destinationFileSystem, FileSystemPath destinationPath, CancellationToken cancellationToken)
 {
     return(entity.FileSystem.CopyAsync(entity.Path, destinationFileSystem, destinationPath, cancellationToken));
 }
 /// <summary>
 /// Copies this entity to a destination file system (async).
 /// </summary>
 public static Task CopyToAsync(this FileSystemEntity entity, IFileSystem destinationFileSystem, FileSystemPath destinationPath)
 {
     return(entity.CopyToAsync(destinationFileSystem, destinationPath, CancellationToken.None));
 }