Private Sub LoadTreeView()
ppcFileView.ShowPlusMinus = True
Try
Dim l_deviceFileList As FileList
l_deviceFileList = m_rapi.EnumFiles("\*")
For Each f As FileInformation In l_deviceFileList
ppcFileView.Nodes.Add(f.FileName)
Next
For Each n As TreeNode In ppcFileView.Nodes
Dim subInfo As FileList
subInfo = m_rapi.EnumFiles("\" & n.Text & "\*")
If Not subInfo Is Nothing Then
For Each f As FileInformation In subInfo
ppcFileView.Nodes(n.Index).Nodes.Add(f.FileName)
Next
End If
Next
Catch ex As RAPIException
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "ManoSync Pro")
End Try
End Sub
Private Sub LoadTopFiles()
ppcFileView.ShowPlusMinus = True
Try
Dim l_deviceFileList As FileList
l_deviceFileList = m_rapi.EnumFiles("\*")
For Each f As FileInformation In l_deviceFileList
Dim l_oNode As New TreeNode
l_oNode.Text = f.FileName
ppcFileView.Nodes.Add(l_oNode)
l_oNode.Nodes.Add("")
Next
Catch ex As RAPIException
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "ManoSync Pro")
End Try
End Sub
Private Sub ppcFileView_BeforeExpand(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewCancelEventArgs) Handles ppcFileView.BeforeExpand
If e.Node.ImageIndex = 2 Then Exit Sub
'MsgBox(e.Node.FullPath)
Try
If e.Node.GetNodeCount(False) = 1 And e.Node.Nodes(0).Text = "" Then
e.Node.Nodes(0).Remove()
EnumerateChildren(e.Node)
End If
Catch ex As Exception
MsgBox("Unable to expand " & e.Node.FullPath & ":" & ex.ToString)
End Try
If e.Node.GetNodeCount(False) > 0 Then
e.Node.ImageIndex = 1
e.Node.SelectedImageIndex = 1
End If
End Sub
Private Sub EnumerateChildren(ByVal p_nodeParent As TreeNode)
If Not p_nodeParent Is Nothing Then
Try
Dim l_deviceFileList As FileList
'get the directory filelist
l_deviceFileList = m_rapi.EnumFiles("\" & p_nodeParent.FullPath & "\*")
'check if empty folder
If Not l_deviceFileList Is Nothing Then
'check if file or directory
If InStr(p_nodeParent.Text, ".", CompareMethod.Text) = 0 Then
For Each f As FileInformation In l_deviceFileList
Dim l_oNode As New TreeNode
l_oNode.Text = f.FileName
If InStr(f.FileName, ".", CompareMethod.Text) = 0 Then
l_oNode.ImageIndex = 0
l_oNode.SelectedImageIndex = 0
Else
l_oNode.ImageIndex = 1
l_oNode.SelectedImageIndex = 1
End If
p_nodeParent.Nodes.Add(l_oNode)
l_oNode.Nodes.Add("")
Next
End If
End If
Catch ex As RAPIException
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "ManoSync Pro")
End Try
End If
End Sub
Private Sub ppcFileView_BeforeCollapse(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewCancelEventArgs) Handles ppcFileView.BeforeCollapse
e.Node.ImageIndex = 0
e.Node.SelectedImageIndex = 0
End Sub