Skip to content

Commit d8a6e45

Browse files
authored
New Wiki Parsing + File Lists (#178)
* - Upgraded Wiki Parser to handle new data format - Modified submission of results to parse for existing results - if an existing result is found, it does not submit the data - Removed redundant controls * - Bumped version - Renamed arguments + disabled "Compress Subfolders" option. * - Moved title * - Removed redundant label * - Added list of files to be compressed to main page
1 parent 7cd64c4 commit d8a6e45

File tree

9 files changed

+282
-353
lines changed

9 files changed

+282
-353
lines changed

CompactGUI/Compact.Designer.vb

Lines changed: 78 additions & 168 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CompactGUI/Compact.resx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,6 @@
129129
<metadata name="ToolTipFilesCompressed.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
130130
<value>460, 17</value>
131131
</metadata>
132-
<data name="seecompest.ToolTip" xml:space="preserve">
133-
<value>For games that contain files &gt;4GB in size, these estimates are likely to be inaccurate (for now).
134-
135-
An update will fix this once more community submissions are made. To speed up the acquisition of new results,
136-
please submit your own results after compression.
137-
</value>
138-
</data>
139132
<data name="help_resultsFilesCompressed.ToolTip" xml:space="preserve">
140133
<value>The number of files compressed may not necessarily equal the total number of files in the folder.
141134
This is often normal, as some files cannot be compressed, or are protected by the system.
@@ -145,15 +138,18 @@ If the number of compressed files appears too small:
145138
• Try running CompactGUI as an Administrator
146139
</value>
147140
</data>
148-
<data name="Label14.ToolTip" xml:space="preserve">
141+
<data name="checkForceCompression.ToolTip" xml:space="preserve">
149142
<value>Forces compression or uncompression of the specified directory or file. This is used in the case of a file that was
150143
partly compressed when the operation was program was closed halfway through an operation.
151144

152145
If you select this option:
153146
• Press "Compress Folder", to compress all the files in the folder, fixing the interrupted file in the process.
154147

155-
• Press "Analys
156-
e Folder" then decompress all the files in the folder, fixing the interrupted file in the process. </value>
148+
• Press "Analyse Folder" then decompress all the files in the folder, fixing the interrupted file in the process. </value>
149+
</data>
150+
<data name="checkHiddenFiles.ToolTip" xml:space="preserve">
151+
<value>Compresses/Uncompresses hidden and system files in addition to the normal files in a folder.
152+
You can leave this unselected in most cases, but some programs may need it checked to fully compress their contents. </value>
157153
</data>
158154
<metadata name="TrayIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
159155
<value>644, 17</value>

CompactGUI/Compact.vb

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ Imports System.Management
77

88

99
Public 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

CompactGUI/My Project/AssemblyInfo.vb

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

35-
<Assembly: AssemblyVersion("2.5.1.0")>
36-
<Assembly: AssemblyFileVersion("2.5.1.0")>
35+
<Assembly: AssemblyVersion("2.6.0.0")>
36+
<Assembly: AssemblyFileVersion("2.6.0.0")>
3737
<Assembly: NeutralResourcesLanguage("en")>

0 commit comments

Comments
 (0)