diff --git a/src/Renci.SshNet/AuthenticationMethod.cs b/src/Renci.SshNet/AuthenticationMethod.cs index 51e49b7ad..99a5e102f 100644 --- a/src/Renci.SshNet/AuthenticationMethod.cs +++ b/src/Renci.SshNet/AuthenticationMethod.cs @@ -1,7 +1,5 @@ using System; -using Renci.SshNet.Common; - namespace Renci.SshNet { /// @@ -34,7 +32,7 @@ public abstract class AuthenticationMethod : IAuthenticationMethod /// is whitespace or null. protected AuthenticationMethod(string username) { - if (username.IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(username)) { throw new ArgumentException("username"); } diff --git a/src/Renci.SshNet/Common/Extensions.cs b/src/Renci.SshNet/Common/Extensions.cs index d5c454c70..d734ffd8b 100644 --- a/src/Renci.SshNet/Common/Extensions.cs +++ b/src/Renci.SshNet/Common/Extensions.cs @@ -15,31 +15,6 @@ namespace Renci.SshNet.Common /// internal static partial class Extensions { - /// - /// Determines whether the specified value is null or white space. - /// - /// The value. - /// - /// true if is null or white space; otherwise, false. - /// - public static bool IsNullOrWhiteSpace(this string value) - { - if (string.IsNullOrEmpty(value)) - { - return true; - } - - for (var i = 0; i < value.Length; i++) - { - if (!char.IsWhiteSpace(value[i])) - { - return false; - } - } - - return true; - } - internal static byte[] ToArray(this ServiceName serviceName) { switch (serviceName) diff --git a/src/Renci.SshNet/ScpClient.cs b/src/Renci.SshNet/ScpClient.cs index 7269e81c3..177a83bb5 100644 --- a/src/Renci.SshNet/ScpClient.cs +++ b/src/Renci.SshNet/ScpClient.cs @@ -243,7 +243,7 @@ public void Upload(Stream source, string path) /// The secure copy execution request was rejected by the server. public void Download(string filename, Stream destination) { - if (filename.IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(filename)) { throw new ArgumentException(Message); } diff --git a/src/Renci.SshNet/SftpClient.cs b/src/Renci.SshNet/SftpClient.cs index 9fe19235a..a275413a1 100644 --- a/src/Renci.SshNet/SftpClient.cs +++ b/src/Renci.SshNet/SftpClient.cs @@ -326,7 +326,7 @@ public void CreateDirectory(string path) { CheckDisposed(); - if (path.IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentException(path); } @@ -355,7 +355,7 @@ public void DeleteDirectory(string path) { CheckDisposed(); - if (path.IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentException("path"); } @@ -384,7 +384,7 @@ public void DeleteFile(string path) { CheckDisposed(); - if (path.IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentException("path"); } @@ -415,7 +415,7 @@ public async Task DeleteFileAsync(string path, CancellationToken cancellationTok { CheckDisposed(); - if (path.IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentException("path"); } @@ -542,12 +542,12 @@ public void SymbolicLink(string path, string linkPath) { CheckDisposed(); - if (path.IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentException("path"); } - if (linkPath.IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(linkPath)) { throw new ArgumentException("linkPath"); } @@ -753,7 +753,7 @@ public bool Exists(string path) { CheckDisposed(); - if (path.IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentException("path"); } @@ -882,7 +882,7 @@ public IAsyncResult BeginDownloadFile(string path, Stream output, AsyncCallback { CheckDisposed(); - if (path.IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentException("path"); } @@ -1109,7 +1109,7 @@ public IAsyncResult BeginUploadFile(Stream input, string path, bool canOverride, throw new ArgumentNullException(nameof(input)); } - if (path.IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentException("path"); } @@ -2106,7 +2106,7 @@ public IEnumerable SynchronizeDirectories(string sourcePath, string de throw new ArgumentNullException(nameof(sourcePath)); } - if (destinationPath.IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(destinationPath)) { throw new ArgumentException("destinationPath"); } @@ -2135,7 +2135,7 @@ public IAsyncResult BeginSynchronizeDirectories(string sourcePath, string destin throw new ArgumentNullException(nameof(sourcePath)); } - if (destinationPath.IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(destinationPath)) { throw new ArgumentException("destDir"); } @@ -2340,7 +2340,7 @@ private void InternalDownloadFile(string path, Stream output, SftpDownloadAsyncR throw new ArgumentNullException(nameof(output)); } - if (path.IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentException("path"); } @@ -2404,7 +2404,7 @@ private void InternalUploadFile(Stream input, string path, Flags flags, SftpUplo throw new ArgumentNullException(nameof(input)); } - if (path.IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentException("path"); }