初始化提交
仓库转移到Gitea,初始化提交,可能丢失以前的git版本日志
This commit is contained in:
50
AUTS_ServiceControler/FtpService.vb
Normal file
50
AUTS_ServiceControler/FtpService.vb
Normal file
@@ -0,0 +1,50 @@
|
||||
Imports FluentFTP
|
||||
|
||||
Public Class FtpService
|
||||
|
||||
Private _ftpUser As String
|
||||
Private _ftpPwd As String
|
||||
Private _ftpPort As Integer
|
||||
Private _ftpHost As String
|
||||
|
||||
Sub New(host As String, port As Integer, user As String, pwd As String)
|
||||
_ftpHost = host
|
||||
_ftpPort = port
|
||||
_ftpUser = user
|
||||
_ftpPwd = pwd
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub OnValidateCertificate(control As FtpClient, e As FtpSslValidationEventArgs)
|
||||
e.Accept = True
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' 文件上传
|
||||
''' 将本地指定路径压缩包上传到FTP服务器上manager文件夹下
|
||||
''' </summary>
|
||||
Public Sub FtpUpload(remotePath As String, loadPath As String)
|
||||
Using ftpClient As FtpClient = New FtpClient(_ftpHost, _ftpPort, _ftpUser, _ftpPwd)
|
||||
AddHandler ftpClient.ValidateCertificate, AddressOf OnValidateCertificate
|
||||
ftpClient.EncryptionMode = FtpEncryptionMode.Auto
|
||||
ftpClient.Connect()
|
||||
ftpClient.UploadFile(loadPath, remotePath)
|
||||
ftpClient.Disconnect()
|
||||
End Using
|
||||
End Sub
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' 文件下载
|
||||
''' 从FTP下载压缩包,到本地指定路径
|
||||
''' </summary>
|
||||
Public Sub FtpDownload(remotePath As String, loadPath As String)
|
||||
Using ftpClient As FtpClient = New FtpClient(_ftpHost, _ftpPort, _ftpUser, _ftpPwd)
|
||||
AddHandler ftpClient.ValidateCertificate, AddressOf OnValidateCertificate
|
||||
ftpClient.EncryptionMode = FtpEncryptionMode.Auto
|
||||
ftpClient.Connect()
|
||||
ftpClient.DownloadFile(loadPath, remotePath)
|
||||
ftpClient.Disconnect()
|
||||
End Using
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user