From c4b3195470eac209eb4451014c5dd05cc5b01cd4 Mon Sep 17 00:00:00 2001 From: Restart <563241175@qq.com> Date: Wed, 15 Jun 2022 05:37:35 +0000 Subject: [PATCH] =?UTF-8?q?update=20Masuit.Tools.Abstractions/Net/FtpClien?= =?UTF-8?q?t.cs.=20=E6=9E=84=E9=80=A0=E5=87=BD=E6=95=B0=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E9=AA=8C=E8=AF=81IP=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E5=8F=82=E6=95=B0=EF=BC=8C=E6=9C=89=E4=BA=9B=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E7=9A=84URL=E5=8F=AF=E8=83=BD=E6=98=AF=E5=9F=9F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Masuit.Tools.Abstractions/Net/FtpClient.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Masuit.Tools.Abstractions/Net/FtpClient.cs b/Masuit.Tools.Abstractions/Net/FtpClient.cs index 38ff2a6..31025e5 100644 --- a/Masuit.Tools.Abstractions/Net/FtpClient.cs +++ b/Masuit.Tools.Abstractions/Net/FtpClient.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -35,10 +35,11 @@ namespace Masuit.Tools.Net /// 获取一个匿名登录的ftp客户端 /// /// 服务器IP地址 + /// 是否验证IP地址 /// - public static FtpClient GetAnonymousClient(string serverIp) + public static FtpClient GetAnonymousClient(string serverIp,bool matchInetAddress=true) { - if (!serverIp.MatchInetAddress()) + if (!serverIp.MatchInetAddress()&&matchInetAddress) { throw new ArgumentException("IP地址格式不正确"); } @@ -55,10 +56,11 @@ namespace Masuit.Tools.Net /// 服务器ip /// 用户名 /// 密码 + /// 是否验证IP地址 /// - public static FtpClient GetClient(string serverIp, string username, string password) + public static FtpClient GetClient(string serverIp, string username, string password,bool matchInetAddress=true) { - if (!serverIp.MatchInetAddress()) + if (!serverIp.MatchInetAddress()&&matchInetAddress) { throw new ArgumentException("IP地址格式不正确"); } -- Gitee