private void Move(string sourceDirName, string destDirName, ISMBCredential sourceCredential, ISMBCredential destinationCredential) { if (sourceCredential == null) { sourceCredential = _credentialProvider.GetSMBCredential(sourceDirName); } if (destinationCredential == null) { destinationCredential = _credentialProvider.GetSMBCredential(destDirName); } CreateDirectory(destDirName, destinationCredential); var dirs = EnumerateDirectories(sourceDirName, "*", SearchOption.TopDirectoryOnly, sourceCredential); foreach (var dir in dirs) { var destDirPath = _fileSystem.Path.Combine(destDirName, new Uri(dir).Segments.Last()); Move(dir, destDirPath, sourceCredential, destinationCredential); } var files = EnumerateFiles(sourceDirName, "*", SearchOption.TopDirectoryOnly, sourceCredential); foreach (var file in files) { var destFilePath = _fileSystem.Path.Combine(destDirName, new Uri(file).Segments.Last()); SMBFile smbFile = _fileSystem.File as SMBFile; smbFile.Move(file, destFilePath, sourceCredential, destinationCredential); } }
public SMBFileSystem(ISMBClientFactory ismbClientfactory, ISMBCredentialProvider credentialProvider, uint maxBufferSize = 65536) { File = new SMBFile(ismbClientfactory, credentialProvider, this, maxBufferSize); Directory = new SMBDirectory(ismbClientfactory, credentialProvider, this, maxBufferSize); DirectoryInfo = new SMBDirectoryInfoFactory(this, credentialProvider, ismbClientfactory, maxBufferSize); FileInfo = new SMBFileInfoFactory(this, credentialProvider, ismbClientfactory, maxBufferSize); FileStream = new SMBFileStreamFactory(this); Path = new SMBPath(this); DriveInfo = new SMBDriveInfoFactory(this, credentialProvider, ismbClientfactory, maxBufferSize); }
public SMBFileSystem(ISMBClientFactory ismbClientfactory, ISMBCredentialProvider credentialProvider, uint maxBufferSize = 65536, ISmbFileSystemSettings smbFileSystemSettings = null, ILoggerFactory loggerFactory = null) { if (smbFileSystemSettings == null) { smbFileSystemSettings = new SmbFileSystemSettings(); } File = new SMBFile(ismbClientfactory, credentialProvider, this, maxBufferSize, smbFileSystemSettings, loggerFactory); Directory = new SMBDirectory(ismbClientfactory, credentialProvider, this, maxBufferSize, smbFileSystemSettings, loggerFactory); DirectoryInfo = new SMBDirectoryInfoFactory(this, credentialProvider, ismbClientfactory, maxBufferSize, loggerFactory); FileInfo = new SMBFileInfoFactory(this, credentialProvider, ismbClientfactory, maxBufferSize, loggerFactory); FileStream = new SMBFileStreamFactory(this); Path = new SMBPath(this); DriveInfo = new SMBDriveInfoFactory(this, credentialProvider, ismbClientfactory, maxBufferSize, loggerFactory); }