All pastes #208886 Raw Edit

Untitled

public text v1 · immutable
#208886 ·published 2006-10-18 21:39 UTC
rendered paste body
 Public Sub ThreadProc(ByVal strmess As String)
                 Try
         
                     UpdateControl(ControlTypes.Label, lblfu, "Running")
                     If fPause = True Then
                         [Pause]()
                     End If
         
                     For Each mfoundDirectory As String In My.Computer.FileSystem.GetDirectories(strmess)
00010:                   cnt += 1
                         If fb = True Then
                             UpdateControl(ControlTypes.Label, lblfu, "abort in process")
                             Exit For
                             Exit Sub
                         End If
                         mstrMesscal = mfoundDirectory
                         UpdateControl(ControlTypes.Label, lblFolders, PArsePath(mstrMesscal))
         
                         UpdateControl(ControlTypes.Label, lblFiles, cnt.ToString)
00020:                   calc = CDec(cnt) / CDec(rea) * 100
                         BackgroundWorker1.ReportProgress(CLng(calc))
                         ThreadProc(mstrMesscal)
                     Next
                 Catch e As Exception
                     Console.WriteLine(e.Message)
                 End Try
             End Sub
         
             Public Function ParsePath(ByVal StrPath As String) As String
00030:           Dim strArry() As String
                 Dim intlen As Integer
                 Dim intPos As Integer = 1
                 Dim intCounter As Integer = 1
                 Dim intTargFound As Integer
                 Dim i As Integer
                 Dim strNewString As String
                 Dim strchar As Char = "\"
         
                 strArry = Split(StrPath, strchar)
00040:   
                 intlen = strArry.Length
                 If intlen < 5 Then
                     Return StrPath
                     Console.WriteLine(StrPath & "less")
                     intlen = 1
                     Exit Function
                 Else
                     For i = 0 To intlen - 1
                         If i = 5 Then
00050:                       strNewString &= strArry(i) & "\.." & vbCr
                             Console.WriteLine(strNewString)
                         Else
                             strNewString &= strArry(i) & "\"
                             Console.WriteLine(strNewString)
                         End If
         
                     Next
                     Return strNewString
         
00060:           End If
         
                 '
             End Function