public override void Move(FileSystemObject sourceFso, FileSystemObject targetFso, IFileStorageProvider targetProvider = null) { var sourceBytes = Get(sourceFso); if (sourceBytes == null) { throw new FileNotFoundException("File does not exist in memory provider", sourceFso.FullName); } if (TreatAsInMemoryProvider(targetProvider)) { if (sourceFso.Equals(targetFso)) { return; } Store(sourceBytes, targetFso); Delete(sourceFso); return; } // Moving across providers (from in-memory to some other file provider), so store then delete source targetProvider.Store(sourceBytes, targetFso); Delete(sourceFso); }
private void CopyInFileSystem(FileSystemObject sourceFso, FileSystemObject targetFso) { if (sourceFso.Equals(targetFso)) { return; } CreateFolder(targetFso.FolderName); File.Copy(sourceFso.FullName, targetFso.FullName, overwrite: true); }
private void MoveInFileSystem(FileSystemObject sourceFso, FileSystemObject targetFso) { if (sourceFso.Equals(targetFso)) { return; } CreateFolder(targetFso.FolderName); File.Move(sourceFso.FullName, targetFso.FullName); }
private void MoveInS3(FileSystemObject sourceFso, FileSystemObject targetFso) { if (sourceFso.Equals(targetFso)) { return; } // Copy, then delete CopyInS3(sourceFso, targetFso); Delete(sourceFso); }
private void CopyInS3(FileSystemObject sourceFso, FileSystemObject targetFso) { if (sourceFso.Equals(targetFso)) { return; } var sourceBki = new S3BucketKeyInfo(sourceFso); var targetBki = new S3BucketKeyInfo(targetFso); var request = new CopyObjectRequest { SourceBucket = sourceBki.BucketName, SourceKey = sourceBki.Key, DestinationBucket = targetBki.BucketName, DestinationKey = targetBki.Key }; S3Client.CopyObject(request); }
public override void Copy(FileSystemObject thisFso, FileSystemObject targetFso, IFileStorageProvider targetProvider = null) { var bytes = Get(thisFso); if (bytes == null) { throw new FileNotFoundException("File does not exist in memory provider", thisFso.FullName); } if (TreatAsInMemoryProvider(targetProvider)) { if (thisFso.Equals(targetFso)) { return; } Store(bytes, targetFso); return; } targetProvider.Store(bytes, targetFso); }