mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-11 01:36:39 +00:00
Replace IsNullOrWhiteSpace extension (#1142)
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
|
||||
using Renci.SshNet.Common;
|
||||
|
||||
namespace Renci.SshNet
|
||||
{
|
||||
/// <summary>
|
||||
@@ -34,7 +32,7 @@ namespace Renci.SshNet
|
||||
/// <exception cref="ArgumentException"><paramref name="username"/> is whitespace or <c>null</c>.</exception>
|
||||
protected AuthenticationMethod(string username)
|
||||
{
|
||||
if (username.IsNullOrWhiteSpace())
|
||||
if (string.IsNullOrWhiteSpace(username))
|
||||
{
|
||||
throw new ArgumentException("username");
|
||||
}
|
||||
|
||||
@@ -15,31 +15,6 @@ namespace Renci.SshNet.Common
|
||||
/// </summary>
|
||||
internal static partial class Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Determines whether the specified value is null or white space.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns>
|
||||
/// <c>true</c> if <paramref name="value"/> is null or white space; otherwise, <c>false</c>.
|
||||
/// </returns>
|
||||
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)
|
||||
|
||||
@@ -243,7 +243,7 @@ namespace Renci.SshNet
|
||||
/// <exception cref="SshException">The secure copy execution request was rejected by the server.</exception>
|
||||
public void Download(string filename, Stream destination)
|
||||
{
|
||||
if (filename.IsNullOrWhiteSpace())
|
||||
if (string.IsNullOrWhiteSpace(filename))
|
||||
{
|
||||
throw new ArgumentException(Message);
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ namespace Renci.SshNet
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
if (path.IsNullOrWhiteSpace())
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
throw new ArgumentException(path);
|
||||
}
|
||||
@@ -355,7 +355,7 @@ namespace Renci.SshNet
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
if (path.IsNullOrWhiteSpace())
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
throw new ArgumentException("path");
|
||||
}
|
||||
@@ -384,7 +384,7 @@ namespace Renci.SshNet
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
if (path.IsNullOrWhiteSpace())
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
throw new ArgumentException("path");
|
||||
}
|
||||
@@ -415,7 +415,7 @@ namespace Renci.SshNet
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
if (path.IsNullOrWhiteSpace())
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
throw new ArgumentException("path");
|
||||
}
|
||||
@@ -542,12 +542,12 @@ namespace Renci.SshNet
|
||||
{
|
||||
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 @@ namespace Renci.SshNet
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
if (path.IsNullOrWhiteSpace())
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
throw new ArgumentException("path");
|
||||
}
|
||||
@@ -882,7 +882,7 @@ namespace Renci.SshNet
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
if (path.IsNullOrWhiteSpace())
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
throw new ArgumentException("path");
|
||||
}
|
||||
@@ -1109,7 +1109,7 @@ namespace Renci.SshNet
|
||||
throw new ArgumentNullException(nameof(input));
|
||||
}
|
||||
|
||||
if (path.IsNullOrWhiteSpace())
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
throw new ArgumentException("path");
|
||||
}
|
||||
@@ -2106,7 +2106,7 @@ namespace Renci.SshNet
|
||||
throw new ArgumentNullException(nameof(sourcePath));
|
||||
}
|
||||
|
||||
if (destinationPath.IsNullOrWhiteSpace())
|
||||
if (string.IsNullOrWhiteSpace(destinationPath))
|
||||
{
|
||||
throw new ArgumentException("destinationPath");
|
||||
}
|
||||
@@ -2135,7 +2135,7 @@ namespace Renci.SshNet
|
||||
throw new ArgumentNullException(nameof(sourcePath));
|
||||
}
|
||||
|
||||
if (destinationPath.IsNullOrWhiteSpace())
|
||||
if (string.IsNullOrWhiteSpace(destinationPath))
|
||||
{
|
||||
throw new ArgumentException("destDir");
|
||||
}
|
||||
@@ -2340,7 +2340,7 @@ namespace Renci.SshNet
|
||||
throw new ArgumentNullException(nameof(output));
|
||||
}
|
||||
|
||||
if (path.IsNullOrWhiteSpace())
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
throw new ArgumentException("path");
|
||||
}
|
||||
@@ -2404,7 +2404,7 @@ namespace Renci.SshNet
|
||||
throw new ArgumentNullException(nameof(input));
|
||||
}
|
||||
|
||||
if (path.IsNullOrWhiteSpace())
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
throw new ArgumentException("path");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user