Public Sub ChangeDirectory(ByVal NewDirectory As String)
' "CHG"/Directory
If Not bCon Then Exit Sub
If Len(NewDirectory) = 0 Then Exit Sub
Dim sPacket As String
sPacket = "CHG" & DELIM & NewDirectory
frmMain.sckMain.SendData sPacket & EOP
End Sub
Public Sub ParseChangeDirectory(ByVal Data As String)
On Error Resume Next
' Successfull: "CHG"/"Directory"/D:Folder1|F:File1*123|F:File2*123
' Folder doesn't exist: "CHG"/"Directory"/"NonExist"
Dim sBuff() As String: sBuff() = Split(Data, DELIM)
If sBuff(2) = "NonExist" Then
frmMain.StatusBar.SimpleText = "Status: Error changing directory; directory does not exist."
Exit Sub
Else
sCurDir = sBuff(1)
frmMain.txtCurDir.Text = sCurDir
Dim sDir() As String, sType() As String, lLoop As Long, sTmpDir As String, sSize() As String
sDir() = Split(sBuff(2), "|")
With frmMain
.TVDir.Nodes.Clear
.LVFile.ListItems.Clear
For lLoop = 0 To UBound(sDir)
sTmpDir = sDir(lLoop)
If Len(sTmpDir) > 0 Then
sType() = Split(sTmpDir, "*?*")
If sType(0) = "D" Then
.TVDir.Nodes.Add , , sType(1), sType(1), "Dir"
ElseIf sType(0) = "F" Then
sSize() = Split(sType(1), "*")
.LVFile.ListItems.Add , , sSize(0), , "FN"
.LVFile.ListItems(.LVFile.ListItems.Count).ListSubItems.Add , , BytesToKB(CDbl(sSize(1)))
.LVFile.ListItems(.LVFile.ListItems.Count).ListSubItems(1).Bold = True
End If
End If
Next lLoop
.LVFile.Refresh
End With
End If
End Sub