afterload代码如下:
If vars("路径") = "" Then
Dim ftp As New FtpClient
ftp.Host="192.168.1.35"
ftp.Account = "tester"
ftp.Password = "tester"
ftp.ChangeDir("/待用户现场确认版本_产线禁止使用/2015") '进入到待用户现场确认版本_产线禁止使用\2015目录
Dim lj As String = "/待用户现场确认版本_产线禁止使用/2015/" & Tables("临时版本跟踪表").current("临时版本编号") & "(" & Tables("临时版本跟踪表").current("客户") & "_" & Tables("临时版本跟踪表").current("博达机型") & ")"
If ftp.DirExists(lj) = False Then '不存在临时版本编号目录时先创建临时版本编号目录
ftp.MakeDir(lj)
End If
Dim ml As String = lj & "/" & Format(Date.now, "yyyy-MM-dd HH-mm-ss")
If ftp.DirExists(ml) = False Then '按照系统时间来创建时间目录
ftp.MakeDir(ml)
End If
Tables("临时版本跟踪表").current("发布目录") = lj
vars("zhygwjj") = ml
msgbox(lj)
ftp.Close
Else
Functions.Execute("listview")----执行listview
End If
listview代码如下:
Dim ftp As New FtpClient
ftp.Host="192.168.1.35"
ftp.Account = "tester"
ftp.Password = "tester"
Dim lvw As WinForm.ListView = Forms("FTP管理器").Controls("ListView1")
lvw.Rows.Clear
lvw.Images.Clear
lvw.Images.LargeSize = new size(32,32)
Dim ics As String() = {"swf","accdb","mdb","psd","png","xls","xlsx","bmp","rar","jpg","doc","docx","zip","pdf","txt","ppt","exe","bin","map","other"} '定义扩展名数组
Dim kzms As String ="swf accdb mdb psd png xls xlsx bmp rar jpg doc docx zip pdf txt ppt exe bin map" '定义已知扩展名的文本串
For Each ic As String In ics
lvw.Images.AddImage(ic,ic & ".png",ic & ".png")
Next
Dim sts As List(of String) = ftp.GetFileList(vars("zhygwjj"))
If sts.Count > 0 Then '若有文件
For Each st As String In sts
Dim r As WinForm.ListViewRow = lvw.Rows.Add
Dim Dot As Integer = st.LastIndexOf(".")
Dim kzm As String = st.SubString(Dot + 1)
r.text = st
If kzms.Contains(kzm) = True Then
r.ImageKey = kzm
Else
r.ImageKey = "other"
End If
Next
End If
ftp.Close
发现这样做发布目录是正确的,可是呢。当发布路径有值了,不论你FTP任何一个发布目录,都listview都是一样的文件,而且是最后一次上传的文件。
正常情况2个不同的FTP路径,链接后文件是不一样的。