Skip to content

Commit

Permalink
Merge pull request #21 from trparky/dev
Browse files Browse the repository at this point in the history
Version 8.0 Build 9
  • Loading branch information
trparky authored Oct 4, 2024
2 parents f205d80 + c0b6d2e commit dce6885
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 233 deletions.
97 changes: 47 additions & 50 deletions Hasher/Form1.vb
Original file line number Diff line number Diff line change
Expand Up @@ -898,8 +898,6 @@ Public Class Form1
propInfo?.SetValue(listFiles, True, Nothing)

If parsedArguments.Count > 0 Then
parsedArguments.ContainsKey("comparefile")

If parsedArguments.ContainsKey("addfile") Or parsedArguments.ContainsKey("comparefile") Then
If boolNamedPipeServerStarted Then
' This instance of the program is the first executed instance so it's the host of the named pipe server.
Expand Down Expand Up @@ -1081,19 +1079,19 @@ Public Class Form1
Dim intTotalNumberOfFiles As Integer = filesInDirectory.Count
Dim percentage As Double

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
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)

filesInDirectory = Nothing

Expand All @@ -1103,6 +1101,10 @@ 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 @@ -1257,7 +1259,6 @@ 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 @@ -1288,43 +1289,39 @@ Public Class Form1
longAllBytes = 0
End SyncLock

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
Dim newDataInFileArray As List(Of String) = dataInFileArray.ToList.Where(Function(strLineInFile2 As String)
Return Not strLineInFile2.Trim.StartsWith("'")
End Function).ToList

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

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
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)

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.8.22")>
<Assembly: AssemblyFileVersion("8.0.9.23")>
Loading

0 comments on commit dce6885

Please sign in to comment.