If TryConnectHost("127.0.0.1") Then
Dim ftp1 As New FtpClient
If ftp1.DirExists(txt) Then
Dim Result As DialogResult
Result = MessageBox.Show("系统中存在同名目录,需要保留原来的数据吗?","提醒",MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
If Result = DialogResult.yes Then
.save()
.refresh
Else If Result = DialogResult.no Then
Dim fls As List(of String)
fls = ftp1.GetFileList(txt)
For Each fl As String In fls
ftp1.DeleteFile(fl)
Next
Else
.current.reject()
.Refresh
Return
End If
Else ftp1.MakeDir(txt)
.save()
.Refresh
End If
Else
MessageBox.Show("网络不通,文件暂时保存在本地,网络联通后再行上传!!","提醒!!",MessageBoxButtons.OK,MessageBoxIcon.Information)
Dim pth As String = ProjectPath & "Attachments\" & txt
If FileSys.DirectoryExists(pth) Then
Dim Result As DialogResult
Result = MessageBox.Show("系统中存在同名目录,需要保留原来的数据吗?","提醒",MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
If Result = DialogResult.yes Then
.save()
.refresh
Else If Result = DialogResult.no Then
For Each File As String In FileSys.GetFiles(pth)
If file Like "*.*" Then
FileSys.DeleteFile(file,3,3)
End If
Next
Else
.current.reject()
.Refresh
Return
End If
Else filesys.CreateDirectory(pth)
.save()
.Refresh
End If
End If