public override int ExecuteOperation() { var destination = _destination; if (!_pathWrapper.IsPathRooted(_destination.Path) && _whereToPut != null) { destination = ActivityIOFactory.CreatePathFromString(_whereToPut + "\\" + _destination.Path, _destination.Username, _destination.Password, _destination.PrivateKeyFile); } _fileLock.EnterWriteLock(); try { using (_currentStream) { if (_impersonatedUser != null) { return(ExecuteOperationWithAuth(_currentStream, destination)); } return(WriteData(_currentStream, destination)); } } finally { _fileLock.ExitWriteLock(); _impersonatedUser?.Undo(); } }