소스 검색

Replace IsNullOrWhiteSpace extension (#1142)

Rob Hague 2 년 전
부모
커밋
457789947c
4개의 변경된 파일15개의 추가작업 그리고 42개의 파일을 삭제
  1. 1 3
      src/Renci.SshNet/AuthenticationMethod.cs
  2. 0 25
      src/Renci.SshNet/Common/Extensions.cs
  3. 1 1
      src/Renci.SshNet/ScpClient.cs
  4. 13 13
      src/Renci.SshNet/SftpClient.cs

+ 1 - 3
src/Renci.SshNet/AuthenticationMethod.cs

@@ -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");
             }

+ 0 - 25
src/Renci.SshNet/Common/Extensions.cs

@@ -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)

+ 1 - 1
src/Renci.SshNet/ScpClient.cs

@@ -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);
             }

+ 13 - 13
src/Renci.SshNet/SftpClient.cs

@@ -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");
             }