Skip to content

Commit

Permalink
Fixed "Analyzing" progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Iridium-IO committed Oct 14, 2017
1 parent 60bbbc9 commit 062dffa
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 16 deletions.
2 changes: 1 addition & 1 deletion WindowsApp1/Compact.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 37 additions & 13 deletions WindowsApp1/Compact.vb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Imports System.Text.RegularExpressions
Imports Ookii.Dialogs 'Uses Ookii Dialogs for the non-archaic filebrowser dialog. http://www.ookii.org/Software/Dialogs

Public Class Compact
Dim version = "1.3"
Dim version = "1.3.1"
Private WithEvents MyProcess As Process
Private Delegate Sub AppendOutputTextDelegate(ByVal text As String)

Expand All @@ -31,7 +31,7 @@ Public Class Compact
Dim fileCountTotal As UInteger = 0
Dim fileCountProgress As UInteger
Dim fileCountOutputCompressed As UInteger

Dim QdirCountProgress As UInteger


Private Sub MyProcess_ErrorDataReceived _
Expand Down Expand Up @@ -80,6 +80,9 @@ Public Class Compact
If e.Data.EndsWith(" are not compressed.") Then 'Gets the output line that identifies the total number of files compressed.
byteComparisonRawFilesCompressed = e.Data
End If
If e.Data.StartsWith(" Listing ") Then 'Gets the output line that identifies the query folder count
QdirCountProgress += 1
End If
Catch ex As Exception

End Try
Expand Down Expand Up @@ -125,18 +128,38 @@ Public Class Compact

If fileCountTotal <> 0 Then 'Makes sure that there are actually files being counted before attempting a calculation

progresspercent.Text = Math.Round _
If isQueryMode = 0 Then

progresspercent.Text = Math.Round _
((fileCountProgress / fileCountTotal * 100), 0).ToString + " %" 'Generates an estimate of progress based on how many files have been processed out of the total.

Try
If compactprogressbar.Value >= 101 Then 'Avoids a /r/softwaregore scenario
compactprogressbar.Value = 1
Else
compactprogressbar.Value = Math.Round _
((fileCountProgress / fileCountTotal * 100), 0)
End If
Catch ex As Exception
End Try
Try
If compactprogressbar.Value >= 101 Then 'Avoids a /r/softwaregore scenario
compactprogressbar.Value = 1
Else
compactprogressbar.Value = Math.Round _
((fileCountProgress / fileCountTotal * 100), 0)
End If
Catch ex As Exception
End Try

ElseIf isQueryMode = 1 Then

progresspercent.Text = Math.Round _
((QdirCountProgress / dirCountTotal * 100), 0).ToString + " %" 'Generates an estimate of progress for the Query command.

Try
If compactprogressbar.Value >= 101 Then 'Avoids a /r/softwaregore scenario
compactprogressbar.Value = 1
Else
compactprogressbar.Value = Math.Round _
((QdirCountProgress / dirCountTotal * 100), 0)
End If
Catch ex As Exception
End Try

End If


End If

Expand All @@ -150,10 +173,11 @@ Public Class Compact
End If

compressFinished = 0

buttonRevert.Visible = True
returnArrow.Visible = True
CalculateSaving()

QdirCountProgress = 0
End If

If uncompressFinished = 1 Then 'Hides and shows certain UI elements when uncompression is finished
Expand Down
4 changes: 2 additions & 2 deletions WindowsApp1/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("1.3.0.0")>
<Assembly: AssemblyFileVersion("1.3.0.0")>
<Assembly: AssemblyVersion("1.3.1.0")>
<Assembly: AssemblyFileVersion("1.3.1.0")>

0 comments on commit 062dffa

Please sign in to comment.