Skip to content

Commit

Permalink
Merge pull request #22 from trparky/dev
Browse files Browse the repository at this point in the history
Version 8.0 Build 11
  • Loading branch information
trparky authored Oct 24, 2024
2 parents 0f92a9d + ba26c2c commit 65ff0e7
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 48 deletions.
95 changes: 48 additions & 47 deletions Hasher/Form1.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1079,19 +1079,19 @@ Public Class Form1
Dim intTotalNumberOfFiles As Integer = filesInDirectory.Count
Dim percentage As Double

Parallel.ForEach(filesInDirectory, Sub(filedata As FastDirectoryEnumerator.FileData)
If boolAbortThread Then Throw New MyThreadAbortException()
intFileIndexNumber += 1
MyInvoke(Sub()
percentage = intFileIndexNumber / intTotalNumberOfFiles * 100
IndividualFilesProgressBar.Value = percentage
ProgressForm.SetTaskbarProgressBarValue(percentage)
lblIndividualFilesStatus.Text = GenerateProcessingFileString(intFileIndexNumber, intTotalNumberOfFiles)
End Sub)
If Not filesInListFiles.Contains(filedata.Path.Trim.ToLower) Then
If IO.File.Exists(filedata.Path) Then collectionOfDataGridRows.Add(CreateFilesDataGridObject(filedata.Path, filedata.Size, listFiles))
End If
End Sub)
For Each filedata As FastDirectoryEnumerator.FileData In filesInDirectory
If boolAbortThread Then Throw New MyThreadAbortException()
intFileIndexNumber += 1
MyInvoke(Sub()
percentage = intFileIndexNumber / intTotalNumberOfFiles * 100
IndividualFilesProgressBar.Value = percentage
ProgressForm.SetTaskbarProgressBarValue(percentage)
lblIndividualFilesStatus.Text = GenerateProcessingFileString(intFileIndexNumber, intTotalNumberOfFiles)
End Sub)
If Not filesInListFiles.Contains(filedata.Path.Trim.ToLower) Then
If IO.File.Exists(filedata.Path) Then collectionOfDataGridRows.Add(CreateFilesDataGridObject(filedata.Path, filedata.Size, listFiles))
End If
Next

filesInDirectory = Nothing

Expand All @@ -1101,10 +1101,6 @@ Public Class Form1

Threading.Thread.Sleep(250)

collectionOfDataGridRows = collectionOfDataGridRows.Where(Function(item As MyDataGridViewRow)
Return item IsNot Nothing
End Function).ToList()

MyInvoke(Sub()
listFiles.Rows.AddRange(collectionOfDataGridRows.ToArray())
collectionOfDataGridRows.Clear()
Expand Down Expand Up @@ -1259,6 +1255,7 @@ Public Class Form1
Dim longFilesThatDidNotPassVerification As Long = 0
Dim longFilesThatWereNotFound As Long = 0
Dim longTotalFiles As Long
Dim regExMatchObject As Text.RegularExpressions.Match
Dim dataInFileArray As String() = IO.File.ReadAllLines(strPathToChecksumFile)
Dim intLineCounter As Integer = 0
Dim myStopWatch As Stopwatch = Stopwatch.StartNew
Expand Down Expand Up @@ -1289,39 +1286,43 @@ Public Class Form1
longAllBytes = 0
End SyncLock

Dim newDataInFileArray As List(Of String) = dataInFileArray.ToList.Where(Function(strLineInFile2 As String)
Return Not strLineInFile2.Trim.StartsWith("'")
End Function).ToList
Dim newDataInFileArray As New List(Of String)
For Each strLineInFile In dataInFileArray
If boolAbortThread Then Throw New MyThreadAbortException
If Not strLineInFile.Trim.StartsWith("'") Then newDataInFileArray.Add(strLineInFile)
Next
strLineInFile = Nothing
dataInFileArray = Nothing

If ChkIncludeEntryCountInFileNameHeader.Checked Then MyInvoke(Sub() lblVerifyFileNameLabel.Text &= $" ({MyToString(newDataInFileArray.Count)} {If(newDataInFileArray.Count = 1, "entry", "entries")} in hash file)")

Parallel.ForEach(newDataInFileArray, Sub(strLineInFile2 As String)
If boolAbortThread Then Throw New MyThreadAbortException
intLineCounter += 1
MyInvoke(Sub()
VerifyHashProgressBar.Value = intLineCounter / newDataInFileArray.LongCount * 100
ProgressForm.SetTaskbarProgressBarValue(VerifyHashProgressBar.Value)
lblVerifyHashStatus.Text = $"{strReadingHashFileMessage} Processing item {MyToString(intLineCounter)} of {MyToString(newDataInFileArray.LongCount)} ({MyRoundingFunction(VerifyHashProgressBar.Value, byteRoundPercentages)}%)."
End Sub)

If Not String.IsNullOrEmpty(strLineInFile2) Then
Dim regExMatchObject As Text.RegularExpressions.Match = hashLineParser.Match(strLineInFile2)

If regExMatchObject.Success Then
strChecksum = regExMatchObject.Groups(1).Value
strFileName = regExMatchObject.Groups(2).Value

If Not IO.Path.IsPathRooted(strFileName) Then
strFileName = IO.Path.Combine(strDirectoryThatContainsTheChecksumFile, strFileName)
End If

listOfDataGridRows.Add(CreateMyDataGridRowForHashFileEntry(strFileName, strChecksum, longFilesThatWereNotFound, boolFileExists, verifyHashesListFiles))
If boolFileExists Then intFileCount += 1
End If

regExMatchObject = Nothing
End If
End Sub)
For Each strLineInFile In newDataInFileArray
If boolAbortThread Then Throw New MyThreadAbortException
intLineCounter += 1
MyInvoke(Sub()
VerifyHashProgressBar.Value = intLineCounter / newDataInFileArray.LongCount * 100
ProgressForm.SetTaskbarProgressBarValue(VerifyHashProgressBar.Value)
lblVerifyHashStatus.Text = $"{strReadingHashFileMessage} Processing item {MyToString(intLineCounter)} of {MyToString(newDataInFileArray.LongCount)} ({MyRoundingFunction(VerifyHashProgressBar.Value, byteRoundPercentages)}%)."
End Sub)

If Not String.IsNullOrEmpty(strLineInFile) Then
regExMatchObject = hashLineParser.Match(strLineInFile)

If regExMatchObject.Success Then
strChecksum = regExMatchObject.Groups(1).Value
strFileName = regExMatchObject.Groups(2).Value

If Not IO.Path.IsPathRooted(strFileName) Then
strFileName = IO.Path.Combine(strDirectoryThatContainsTheChecksumFile, strFileName)
End If

listOfDataGridRows.Add(CreateMyDataGridRowForHashFileEntry(strFileName, strChecksum, longFilesThatWereNotFound, boolFileExists, verifyHashesListFiles))
If boolFileExists Then intFileCount += 1
End If

regExMatchObject = Nothing
End If
Next

MyInvoke(Sub()
verifyHashesListFiles.Rows.AddRange(listOfDataGridRows.ToArray)
Expand Down
2 changes: 1 addition & 1 deletion Hasher/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ Imports System.Runtime.InteropServices
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("8.0.10.24")>
<Assembly: AssemblyFileVersion("8.0.11.25")>

0 comments on commit 65ff0e7

Please sign in to comment.