예제 #1
0
 public static Task <bool> MoveWithProgressAsync(
     string source,
     string destination,
     Action <Progress> progress)
 {
     return(Task.Run(() =>
     {
         string destination1 = destination;
         bool?nullable = source.IsPathFile();
         bool flag = false;
         if (nullable.GetValueOrDefault() == flag & nullable.HasValue)
         {
             destination1 = FileSystemHelper.CorrectFileDestinationPath(source, destination);
         }
         return Utility.FileSystem.Transfer.Service.Infrastructure.FileTransferHelper.MoveWithProgress(source, destination1, progress);
     }));
 }
예제 #2
0
        public static OperationResult CopyWithProgress(
            string source,
            string destination,
            Action <Progress> progress,
            bool continueOnFailure,
            CancellationToken cancellationToken,
            bool copyContentOfDirectory = false)
        {
            bool?nullable1 = source.IsPathFile();
            bool?nullable2 = nullable1 ?? throw new ArgumentException("Source parameter has to be file or directory! " + source);
            bool flag      = true;

            if (nullable2.GetValueOrDefault() == flag & nullable2.HasValue)
            {
                return(FileTransferHelper.CopyDirectoryWithProgress(source, destination, progress, continueOnFailure, cancellationToken, copyContentOfDirectory));
            }
            if (cancellationToken.IsCancellationRequested)
            {
                return(OperationResult.Cancelled);
            }
            string newFile = FileSystemHelper.CorrectFileDestinationPath(source, destination);

            return(CopyFileWithProgress(source, newFile, progress, cancellationToken));
        }