CanMoveFilesFrom() public method

public CanMoveFilesFrom ( Repository srcRepository, FilePath localSrcPath, FilePath localDestPath ) : bool
srcRepository Repository
localSrcPath FilePath
localDestPath FilePath
return bool
Esempio n. 1
0
        public override void MoveDirectory(FilePath sourcePath, FilePath destPath)
        {
            ProgressMonitor monitor = new ProgressMonitor();

            Repository srcRepo = GetRepository(sourcePath);
            Repository dstRepo = GetRepository(destPath);

            if (dstRepo.CanMoveFilesFrom(srcRepo, sourcePath, destPath))
            {
                Task.Run(async() => {
                    Monitor.TryEnter(moveDirectoryLock);
                    try {
                        await srcRepo.MoveDirectoryAsync(sourcePath, destPath, true, monitor);
                    } catch (OperationCanceledException) {
                        return;
                    } catch (Exception e) {
                        LoggingService.LogError("Error while moving directory.", e);
                    } finally {
                        Monitor.Exit(moveDirectoryLock);
                    }
                });
            }
            else
            {
                CopyDirectory(sourcePath, destPath);
                srcRepo.DeleteDirectory(sourcePath, true, monitor, false);
            }
        }
        public override void MoveDirectory(FilePath sourcePath, FilePath destPath)
        {
            ProgressMonitor monitor = new ProgressMonitor();

            Repository srcRepo = GetRepository(sourcePath);
            Repository dstRepo = GetRepository(destPath);

            if (dstRepo.CanMoveFilesFrom(srcRepo, sourcePath, destPath))
            {
                try {
                    srcRepo.MoveDirectoryAsync(sourcePath, destPath, true, monitor).Wait();
                } catch (AggregateException e) {
                    foreach (var inner in e.InnerExceptions)
                    {
                        if (inner is OperationCanceledException)
                        {
                            continue;
                        }
                        LoggingService.LogError("Error while moving directory.", inner);
                    }
                }
            }
            else
            {
                CopyDirectory(sourcePath, destPath);
                srcRepo.DeleteDirectory(sourcePath, true, monitor, false);
            }
        }
Esempio n. 3
0
        public override void MoveFile(FilePath source, FilePath dest)
        {
            ProgressMonitor monitor = new ProgressMonitor();

            Repository srcRepo = GetRepository(source);
            Repository dstRepo = GetRepository(dest);

            if (dstRepo != null && dstRepo.CanMoveFilesFrom(srcRepo, source, dest))
            {
                srcRepo.MoveFile(source, dest, true, monitor);
            }
            else
            {
                CopyFile(source, dest, true);
                srcRepo.DeleteFile(source, true, monitor, false);
            }
        }
Esempio n. 4
0
        public override void MoveDirectory(FilePath sourcePath, FilePath destPath)
        {
            ProgressMonitor monitor = new ProgressMonitor();

            Repository srcRepo = GetRepository(sourcePath);
            Repository dstRepo = GetRepository(destPath);

            if (dstRepo.CanMoveFilesFrom(srcRepo, sourcePath, destPath))
            {
                srcRepo.MoveDirectory(sourcePath, destPath, true, monitor);
            }
            else
            {
                CopyDirectory(sourcePath, destPath);
                srcRepo.DeleteDirectory(sourcePath, true, monitor, false);
            }
        }
        public override void MoveDirectory(string sourcePath, string destPath)
        {
            IProgressMonitor monitor = new NullProgressMonitor();

            Repository srcRepo = GetRepository(sourcePath);
            Repository dstRepo = GetRepository(destPath);

            if (dstRepo.CanMoveFilesFrom(srcRepo, sourcePath, destPath))
            {
                srcRepo.MoveDirectory(sourcePath, destPath, true, monitor);
            }
            else
            {
                CopyDirectory(sourcePath, destPath);
                srcRepo.DeleteDirectory(sourcePath, true, monitor);
            }
        }
        public override void MoveFile(string source, string dest)
        {
            IProgressMonitor monitor = new NullProgressMonitor();

            Repository srcRepo = GetRepository(source);
            Repository dstRepo = GetRepository(dest);

            if (dstRepo.CanMoveFilesFrom(srcRepo, source, dest))
            {
                srcRepo.MoveFile(source, dest, true, monitor);
            }
            else
            {
                CopyFile(source, dest, true);
                srcRepo.DeleteFile(source, true, monitor);
            }
        }