Skip to content

Commit 1534197

Browse files
committed
remove notifyOnEmptyFile Flag
1 parent 3db899a commit 1534197

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

src/Renci.SshNet/ScpClient.cs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,12 @@ internal ScpClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServ
240240
/// </summary>
241241
/// <param name="source">The <see cref="Stream"/> to upload.</param>
242242
/// <param name="path">A relative or absolute path for the remote file.</param>
243-
/// <param name="notifyOnEmptyFile">Should the <see cref="Uploading"/> event be raised when the file is empty?</param>
244243
/// <exception cref="ArgumentNullException"><paramref name="path" /> is <see langword="null"/>.</exception>
245244
/// <exception cref="ArgumentException"><paramref name="path"/> is a zero-length <see cref="string"/>.</exception>
246245
/// <exception cref="ScpException">A directory with the specified path exists on the remote host.</exception>
247246
/// <exception cref="SshException">The secure copy execution request was rejected by the server.</exception>
248247
/// <exception cref="SshConnectionException">Client is not connected.</exception>
249-
public void Upload(Stream source, string path, bool notifyOnEmptyFile=false)
248+
public void Upload(Stream source, string path)
250249
{
251250
if (Session is null)
252251
{
@@ -272,7 +271,7 @@ public void Upload(Stream source, string path, bool notifyOnEmptyFile=false)
272271
CheckReturnCode(input);
273272

274273
UploadFileModeAndName(channel, input, source.Length, posixPath.File);
275-
UploadFileContent(channel, input, source, posixPath.File, notifyOnEmptyFile);
274+
UploadFileContent(channel, input, source, posixPath.File);
276275
}
277276
}
278277

@@ -281,14 +280,13 @@ public void Upload(Stream source, string path, bool notifyOnEmptyFile=false)
281280
/// </summary>
282281
/// <param name="fileInfo">The file system info.</param>
283282
/// <param name="path">A relative or absolute path for the remote file.</param>
284-
/// <param name="notifyOnEmptyFile">Should the <see cref="Uploading"/> event be raised when the file is empty?</param>
285283
/// <exception cref="ArgumentNullException"><paramref name="fileInfo" /> is <see langword="null"/>.</exception>
286284
/// <exception cref="ArgumentNullException"><paramref name="path" /> is <see langword="null"/>.</exception>
287285
/// <exception cref="ArgumentException"><paramref name="path"/> is a zero-length <see cref="string"/>.</exception>
288286
/// <exception cref="ScpException">A directory with the specified path exists on the remote host.</exception>
289287
/// <exception cref="SshException">The secure copy execution request was rejected by the server.</exception>
290288
/// <exception cref="SshConnectionException">Client is not connected.</exception>
291-
public void Upload(FileInfo fileInfo, string path, bool notifyOnEmptyFile=false)
289+
public void Upload(FileInfo fileInfo, string path)
292290
{
293291
ThrowHelper.ThrowIfNull(fileInfo);
294292

@@ -319,7 +317,7 @@ public void Upload(FileInfo fileInfo, string path, bool notifyOnEmptyFile=false)
319317
{
320318
UploadTimes(channel, input, fileInfo);
321319
UploadFileModeAndName(channel, input, source.Length, posixPath.File);
322-
UploadFileContent(channel, input, source, fileInfo.Name, notifyOnEmptyFile);
320+
UploadFileContent(channel, input, source, fileInfo.Name);
323321
}
324322
}
325323
}
@@ -329,14 +327,13 @@ public void Upload(FileInfo fileInfo, string path, bool notifyOnEmptyFile=false)
329327
/// </summary>
330328
/// <param name="directoryInfo">The directory info.</param>
331329
/// <param name="path">A relative or absolute path for the remote directory.</param>
332-
/// <param name="notifyOnEmptyFile">Should the <see cref="Uploading"/> event be raised when the file is empty?</param>
333330
/// <exception cref="ArgumentNullException"><paramref name="directoryInfo"/> is <see langword="null"/>.</exception>
334331
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <see langword="null"/>.</exception>
335332
/// <exception cref="ArgumentException"><paramref name="path"/> is a zero-length string.</exception>
336333
/// <exception cref="ScpException"><paramref name="path"/> does not exist on the remote host, is not a directory or the user does not have the required permission.</exception>
337334
/// <exception cref="SshException">The secure copy execution request was rejected by the server.</exception>
338335
/// <exception cref="SshConnectionException">Client is not connected.</exception>
339-
public void Upload(DirectoryInfo directoryInfo, string path, bool notifyOnEmptyFile=false)
336+
public void Upload(DirectoryInfo directoryInfo, string path)
340337
{
341338
ThrowHelper.ThrowIfNull(directoryInfo);
342339
ThrowHelper.ThrowIfNullOrEmpty(path);
@@ -365,7 +362,7 @@ public void Upload(DirectoryInfo directoryInfo, string path, bool notifyOnEmptyF
365362

366363
CheckReturnCode(input);
367364

368-
UploadDirectoryContent(channel, input, directoryInfo, notifyOnEmptyFile);
365+
UploadDirectoryContent(channel, input, directoryInfo);
369366
}
370367
}
371368

@@ -559,11 +556,10 @@ private void UploadFileModeAndName(IChannelSession channel, Stream input, long f
559556
/// <param name="input">A <see cref="Stream"/> from which any feedback from the server can be read.</param>
560557
/// <param name="source">The content to upload.</param>
561558
/// <param name="remoteFileName">The name of the remote file, without path, to which the content is uploaded.</param>
562-
/// <param name="notifyOnEmptyFile">Should the <see cref="Uploading"/> event be raised when the file is empty?</param>
563559
/// <remarks>
564560
/// <paramref name="remoteFileName"/> is only used for raising the <see cref="Uploading"/> event.
565561
/// </remarks>
566-
private void UploadFileContent(IChannelSession channel, Stream input, Stream source, string remoteFileName, bool notifyOnEmptyFile)
562+
private void UploadFileContent(IChannelSession channel, Stream input, Stream source, string remoteFileName)
567563
{
568564
var totalLength = source.Length;
569565
var buffer = new byte[BufferSize];
@@ -583,7 +579,7 @@ private void UploadFileContent(IChannelSession channel, Stream input, Stream sou
583579
read = source.Read(buffer, 0, buffer.Length);
584580
}
585581

586-
if (totalLength == 0 && totalRead == 0 && notifyOnEmptyFile)
582+
if (totalLength == 0 && totalRead == 0)
587583
{
588584
RaiseUploadingEvent(remoteFileName, totalLength, totalRead);
589585
}
@@ -696,8 +692,7 @@ private void UploadTimes(IChannelSession channel, Stream input, FileSystemInfo f
696692
/// <param name="channel">The channel to perform the upload in.</param>
697693
/// <param name="input">A <see cref="Stream"/> from which any feedback from the server can be read.</param>
698694
/// <param name="directoryInfo">The directory to upload.</param>
699-
/// <param name="notifyOnEmptyFile">Should the <see cref="Uploading"/> event be raised when the file is empty?</param>
700-
private void UploadDirectoryContent(IChannelSession channel, Stream input, DirectoryInfo directoryInfo, bool notifyOnEmptyFile=false)
695+
private void UploadDirectoryContent(IChannelSession channel, Stream input, DirectoryInfo directoryInfo)
701696
{
702697
// Upload files
703698
var files = directoryInfo.GetFiles();
@@ -707,7 +702,7 @@ private void UploadDirectoryContent(IChannelSession channel, Stream input, Direc
707702
{
708703
UploadTimes(channel, input, file);
709704
UploadFileModeAndName(channel, input, source.Length, file.Name);
710-
UploadFileContent(channel, input, source, file.Name, notifyOnEmptyFile);
705+
UploadFileContent(channel, input, source, file.Name);
711706
}
712707
}
713708

@@ -717,7 +712,7 @@ private void UploadDirectoryContent(IChannelSession channel, Stream input, Direc
717712
{
718713
UploadTimes(channel, input, directory);
719714
UploadDirectoryModeAndName(channel, input, directory.Name);
720-
UploadDirectoryContent(channel, input, directory, notifyOnEmptyFile);
715+
UploadDirectoryContent(channel, input, directory);
721716
}
722717

723718
// Mark upload of current directory complete

0 commit comments

Comments
 (0)