Dim str As DataRow = DataTables("类型").DataRows(0) '在这个表设置ftp连接信息
Dim ftp As new ftpclient
ftp.host= str("IP")
ftp.Port= str("Port")
ftp.Account = str("Account")
ftp.password = str("Password")
If ftp.DirExists(_TSG)
Else
ftp.MakeDir(_TSG)
End If
ftp.RootDir = _TSG
Dim ds As new List(of String)
Dim ds1 As new List(of String)
Dim ds2 As new List(of String)
ds.Clear
ds1.Clear
ds2.Clear
ds = ftp.GetDirList()
If ds.Count = 0
Return ""
End If
If DataTables.Contains(_TSGMC) = False
Dim dtb As New DataTableBuilder(_TSGMC)
dtb.AddDef("系目", Gettype(String), 100)
dtb.AddDef("类目", Gettype(String), 100)
dtb.Build()
'MainTable= Tables(_TSGMC)
Dim dr As Row
Dim ss As String
For i As Integer = 0 To ds.count -1
ds1.Clear
ds1.AddRange(ftp.GetDirList(ftp.RootDir & ds(i)))
For Each st As String In ds1
If ds2.Contains(ftp.RootDir & ds(i) & "/" & st) = False
ds2.add(ftp.RootDir & ds(i) & "/" & st)
End If
Next
Next
If ds2.Count > Tables(_TSGMC).Rows.Count
Tables(_TSGMC).AddNew(ds2.Count - Tables(_TSGMC).Rows.Count)
End If
For i As Integer = 0 To ds2.count -1
dr = Tables(_TSGMC).Rows(i)
ss = ds2(i)
ss = ss.Replace("/","\")
dr("系目") = ss.SubString(1).SubString(ss.SubString(1).IndexOf("\")+1) 'ss += ds2(i) & ","
Next
Dim tv As WinForm.TreeView = Forms(_TSGCC).Controls("TreeView1")
tv.CreateTree(_TSGMC,"系目") '
tv.Nodes.Insert(_TSGMC,0)
tv.Nodes(_TSGMC).Ic
Else
Dim tv As WinForm.TreeView = Forms(_TSGCC).Controls("TreeView1")
tv.CreateTree(_TSGMC,"系目") '
tv.Nodes.Insert(_TSGMC,0)
tv.Nodes(_TSGMC).Ic
End If
[此贴子已经被作者于2014-11-4 20:00:06编辑过]