@@ -7,9 +7,8 @@ Imports System.Management
77
88
99Public Class Compact
10- Public Shared version = "2.5.1 "
10+ Public Shared version = "2.6.0 "
1111 Private WithEvents MyProcess As Process
12- Private Delegate Sub AppendOutputTextDelegate( ByVal text As String )
1312
1413
1514
@@ -121,7 +120,7 @@ Public Class Compact
121120 ListOfFiles.Clear()
122121 AllFiles.Clear()
123122 TreeData.Clear()
124-
123+ SelectedFiles.Items.Clear()
125124 directorysizeexceptionCount = 0
126125
127126 If DI_selectedDir.Name.Length > 0 Then _
@@ -141,6 +140,15 @@ Public Class Compact
141140 Dim oldFolderSize_Formatted = GetOutputSize(oldFolderSize, True )
142141
143142 GetFilesToCompress(workingDir, ListOfFiles, My.Settings.SkipNonCompressable)
143+
144+ For Each fileName In ListOfFiles
145+ Dim fN_Listable = fileName.Replace(workingDir, "" ).Replace( "\" , " ❯ " )
146+ If fN_Listable.Count( Function (x) x = "❯" ) = 1 Then fN_Listable = fN_Listable.Replace( " ❯ " , "" )
147+ SelectedFiles.Items.Add(fN_Listable)
148+ Next
149+
150+
151+
144152 PrepareforCompact()
145153
146154 UnfurlTransition.UnfurlControl(topbar_dirchooserContainer, topbar_dirchooserContainer.Width, Me .Width - sb_Panel.Width - 46 , 100 )
@@ -151,7 +159,7 @@ Public Class Compact
151159 .AutoSize = True
152160 .TextAlign = ContentAlignment.MiddleLeft
153161 .Font = New Font(topbar_title.Font.Name, 15.75 , FontStyle.Regular)
154- .Location = New Point( 59 , 18 )
162+ .Location = New Point( 39 , 20 )
155163 End With
156164
157165 If overrideCompressFolderButton <> 0 Then btnCompress.Enabled = False 'Used as a security measure to stop accidental compression of folders that should not be compressed - even though the compact.exe process will throw an error if you try, I'd prefer to catch it here anyway.
@@ -166,18 +174,21 @@ Public Class Compact
166174
167175
168176
169- Shared NonCompressableSet As New List( Of String )(Regex.Replace(My.Settings.NonCompressableList, "\s+" , "" ).Split( ";"c ))
177+
170178
171179
172180 Public ListOfFiles As New List( Of String )
173181 Dim FileIndex As Integer = 0
174182
175183 Private Sub GetFilesToCompress( ByVal targetDirectory As String , targetOutputList As List( Of String ), LimitSelectedFiles As Boolean )
176184
185+ Dim NonCompressableSet As New List( Of String )(Regex.Replace(My.Settings.NonCompressableList, "\s+" , "" ).Split( ";"c ))
186+
177187 Dim fileEntries As String () = Directory.GetFiles(targetDirectory)
178188 Dim fileName As String ' Process the list of files found in the directory.
179189
180190 For Each fileName In fileEntries
191+
181192 If LimitSelectedFiles = True Then
182193 If Path.GetExtension(fileName) = "" OrElse NonCompressableSet.Contains(Path.GetExtension(fileName).TrimStart( "." ).ToLowerInvariant) = False Then
183194 targetOutputList.Add(fileName)
@@ -499,25 +510,24 @@ Public Class Compact
499510
500511
501512
502- compRatioLabel.Text = Math.Round(SizeBeforeCompression / SizeAfterCompression, 1 )
513+ Dim compRatio = Math.Round(SizeBeforeCompression / SizeAfterCompression, 1 )
503514
504515
505516 spaceSavedLabel.Text = GetOutputSize((SizeBeforeCompression - SizeAfterCompression), True ) + " Saved"
506- sb_SpaceSavedLabel.Text = spaceSavedLabel.Text
507517
508518 labelFilesCompressed.Text = numberFilesCompressed & " / " & AllFiles.Count & " files compressed"
509519 help_resultsFilesCompressed.Location = New Point(labelFilesCompressed.Location.X + labelFilesCompressed.Width + 2 , labelFilesCompressed.Location.Y + 1 )
510520
511521
512522 Try
513523
514- compressedSizeVisual.Width = CInt ( 320 / compRatioLabel.Text )
515- sb_compressedSizeVisual.Height = CInt ( 113 / compRatioLabel.Text )
524+ compressedSizeVisual.Width = CInt ( 320 / compRatio )
525+ sb_compressedSizeVisual.Height = CInt ( 113 / compRatio )
516526 sb_compressedSizeVisual.Location = New Point(sb_compressedSizeVisual.Location.X, 5 + 113 - sb_compressedSizeVisual.Height)
517527
518528 Callpercent = ( CDec ( 1 - (SizeAfterCompression / SizeBeforeCompression))) * 100
519529 If My.Settings.ShowNotifications Then _
520- TrayIcon.ShowBalloonTip( 1 , "Compressed: " & StrConv( sb_FolderName.Text, VbStrConv.ProperCase) , vbCrLf & "▸ " & spaceSavedLabel.Text & vbCrLf & "▸ " & Math.Round(Callpercent, 1 ) & "% Smaller" , ToolTipIcon.None)
530+ TrayIcon.ShowBalloonTip( 1 , "Compressed: " & sb_FolderName.Text, vbCrLf & "▸ " & spaceSavedLabel.Text & vbCrLf & "▸ " & Math.Round(Callpercent, 1 ) & "% Smaller" , ToolTipIcon.None)
521531
522532 Catch ex As OverflowException
523533 compressedSizeVisual.Width = 320
@@ -884,6 +894,24 @@ Public Class Compact
884894
885895
886896
897+
898+ Private Sub ListBox1_DrawItem( ByVal sender As Object , ByVal e As DrawItemEventArgs) Handles SelectedFiles.DrawItem
899+ e.DrawBackground()
900+ e.Graphics.DrawString(SelectedFiles.Items(e.Index).ToString, SelectedFiles.Font, Brushes.Gray, e.Bounds.Left, ((e.Bounds.Height - SelectedFiles.Font.Height) \ 2 ) + e.Bounds.Top)
901+ End Sub
902+
903+ Private Sub ListBox1_MeasureItem( ByVal sender As Object , ByVal e As MeasureItemEventArgs) Handles SelectedFiles.MeasureItem
904+ e.ItemHeight = 22
905+ End Sub
906+
907+ Private Sub Panel1_Paint(sender As Object , e As PaintEventArgs) Handles Panel1.Paint
908+ Dim p As New Pen(Brushes.Silver, 1 )
909+ e.Graphics.DrawLine(p, New Point( 15 , 0 ), New Point(Panel1.Width, 0 ))
910+ End Sub
911+
912+
913+
914+
887915 Private Sub dirChooser_MouseEnter(sender As Object , e As EventArgs) Handles dirChooser.MouseEnter
888916 dirChooser.LinkColor = Color.FromArgb( 200 , 200 , 200 )
889917 End Sub
0 commit comments