Skip to content

Commit 062dffa

Browse files
committed
Fixed "Analyzing" progress bar
1 parent 60bbbc9 commit 062dffa

File tree

3 files changed

+40
-16
lines changed

3 files changed

+40
-16
lines changed

WindowsApp1/Compact.Designer.vb

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WindowsApp1/Compact.vb

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Imports System.Text.RegularExpressions
55
Imports Ookii.Dialogs 'Uses Ookii Dialogs for the non-archaic filebrowser dialog. http://www.ookii.org/Software/Dialogs
66

77
Public Class Compact
8-
Dim version = "1.3"
8+
Dim version = "1.3.1"
99
Private WithEvents MyProcess As Process
1010
Private Delegate Sub AppendOutputTextDelegate(ByVal text As String)
1111

@@ -31,7 +31,7 @@ Public Class Compact
3131
Dim fileCountTotal As UInteger = 0
3232
Dim fileCountProgress As UInteger
3333
Dim fileCountOutputCompressed As UInteger
34-
34+
Dim QdirCountProgress As UInteger
3535

3636

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

8588
End Try
@@ -125,18 +128,38 @@ Public Class Compact
125128

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

128-
progresspercent.Text = Math.Round _
131+
If isQueryMode = 0 Then
132+
133+
progresspercent.Text = Math.Round _
129134
((fileCountProgress / fileCountTotal * 100), 0).ToString + " %" 'Generates an estimate of progress based on how many files have been processed out of the total.
130135

131-
Try
132-
If compactprogressbar.Value >= 101 Then 'Avoids a /r/softwaregore scenario
133-
compactprogressbar.Value = 1
134-
Else
135-
compactprogressbar.Value = Math.Round _
136-
((fileCountProgress / fileCountTotal * 100), 0)
137-
End If
138-
Catch ex As Exception
139-
End Try
136+
Try
137+
If compactprogressbar.Value >= 101 Then 'Avoids a /r/softwaregore scenario
138+
compactprogressbar.Value = 1
139+
Else
140+
compactprogressbar.Value = Math.Round _
141+
((fileCountProgress / fileCountTotal * 100), 0)
142+
End If
143+
Catch ex As Exception
144+
End Try
145+
146+
ElseIf isQueryMode = 1 Then
147+
148+
progresspercent.Text = Math.Round _
149+
((QdirCountProgress / dirCountTotal * 100), 0).ToString + " %" 'Generates an estimate of progress for the Query command.
150+
151+
Try
152+
If compactprogressbar.Value >= 101 Then 'Avoids a /r/softwaregore scenario
153+
compactprogressbar.Value = 1
154+
Else
155+
compactprogressbar.Value = Math.Round _
156+
((QdirCountProgress / dirCountTotal * 100), 0)
157+
End If
158+
Catch ex As Exception
159+
End Try
160+
161+
End If
162+
140163

141164
End If
142165

@@ -150,10 +173,11 @@ Public Class Compact
150173
End If
151174

152175
compressFinished = 0
176+
153177
buttonRevert.Visible = True
154178
returnArrow.Visible = True
155179
CalculateSaving()
156-
180+
QdirCountProgress = 0
157181
End If
158182

159183
If uncompressFinished = 1 Then 'Hides and shows certain UI elements when uncompression is finished

WindowsApp1/My Project/AssemblyInfo.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
3131
' by using the '*' as shown below:
3232
' <Assembly: AssemblyVersion("1.0.*")>
3333

34-
<Assembly: AssemblyVersion("1.3.0.0")>
35-
<Assembly: AssemblyFileVersion("1.3.0.0")>
34+
<Assembly: AssemblyVersion("1.3.1.0")>
35+
<Assembly: AssemblyFileVersion("1.3.1.0")>

0 commit comments

Comments
 (0)