1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
Private Function parseDirectory(ByVal myDirInfo As System.IO.DirectoryInfo) As String()
Dim sLstDir As String
Dim result As String()
sLstDir = lstDir(myDirInfo, 0)
sLstDir = sLstDir.Substring(1, sLstDir.Length - 1)
result = sLstDir.Split(";")
Return result
End Function
Private Function lstDir(ByVal myDirInfo As System.IO.DirectoryInfo, ByVal myLevel As Integer) As String
Dim aDir As System.IO.DirectoryInfo()
Dim result As String = ""
Dim i As Integer
aDir = myDirInfo.GetDirectories()
For i = 0 To aDir.GetUpperBound(0)
result = result & ";" & twoDigit(myLevel + 1) & aDir(i).Name & lstDir(aDir(i), myLevel + 1)
Next
Return result
End Function
Private Function twoDigit(ByVal myInt As Integer) As String
Dim Result As String = ""
Select Case CBool(myInt > 9)
Case True
If myInt > 99 Then
Result = "99"
Else
Result = myInt.ToString
End If
Case False
If myInt < 0 Then
Result = "00"
Else
Result = "0" & myInt.ToString
End If
End Select
Return Result
End Function |
Partager