Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
246 changes: 78 additions & 168 deletions CompactGUI/Compact.Designer.vb

Large diffs are not rendered by default.

16 changes: 6 additions & 10 deletions CompactGUI/Compact.resx
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,6 @@
<metadata name="ToolTipFilesCompressed.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>460, 17</value>
</metadata>
<data name="seecompest.ToolTip" xml:space="preserve">
<value>For games that contain files &gt;4GB in size, these estimates are likely to be inaccurate (for now).

An update will fix this once more community submissions are made. To speed up the acquisition of new results,
please submit your own results after compression.
</value>
</data>
<data name="help_resultsFilesCompressed.ToolTip" xml:space="preserve">
<value>The number of files compressed may not necessarily equal the total number of files in the folder.
This is often normal, as some files cannot be compressed, or are protected by the system.
Expand All @@ -145,15 +138,18 @@ If the number of compressed files appears too small:
• Try running CompactGUI as an Administrator
</value>
</data>
<data name="Label14.ToolTip" xml:space="preserve">
<data name="checkForceCompression.ToolTip" xml:space="preserve">
<value>Forces compression or uncompression of the specified directory or file. This is used in the case of a file that was
partly compressed when the operation was program was closed halfway through an operation.

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

• Press "Analys
e Folder" then decompress all the files in the folder, fixing the interrupted file in the process. </value>
• Press "Analyse Folder" then decompress all the files in the folder, fixing the interrupted file in the process. </value>
</data>
<data name="checkHiddenFiles.ToolTip" xml:space="preserve">
<value>Compresses/Uncompresses hidden and system files in addition to the normal files in a folder.
You can leave this unselected in most cases, but some programs may need it checked to fully compress their contents. </value>
</data>
<metadata name="TrayIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>644, 17</value>
Expand Down
48 changes: 38 additions & 10 deletions CompactGUI/Compact.vb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ Imports System.Management


Public Class Compact
Public Shared version = "2.5.1"
Public Shared version = "2.6.0"
Private WithEvents MyProcess As Process
Private Delegate Sub AppendOutputTextDelegate(ByVal text As String)



Expand Down Expand Up @@ -121,7 +120,7 @@ Public Class Compact
ListOfFiles.Clear()
AllFiles.Clear()
TreeData.Clear()

SelectedFiles.Items.Clear()
directorysizeexceptionCount = 0

If DI_selectedDir.Name.Length > 0 Then _
Expand All @@ -141,6 +140,15 @@ Public Class Compact
Dim oldFolderSize_Formatted = GetOutputSize(oldFolderSize, True)

GetFilesToCompress(workingDir, ListOfFiles, My.Settings.SkipNonCompressable)

For Each fileName In ListOfFiles
Dim fN_Listable = fileName.Replace(workingDir, "").Replace("\", " ❯ ")
If fN_Listable.Count(Function(x) x = "❯") = 1 Then fN_Listable = fN_Listable.Replace(" ❯ ", "")
SelectedFiles.Items.Add(fN_Listable)
Next



PrepareforCompact()

UnfurlTransition.UnfurlControl(topbar_dirchooserContainer, topbar_dirchooserContainer.Width, Me.Width - sb_Panel.Width - 46, 100)
Expand All @@ -151,7 +159,7 @@ Public Class Compact
.AutoSize = True
.TextAlign = ContentAlignment.MiddleLeft
.Font = New Font(topbar_title.Font.Name, 15.75, FontStyle.Regular)
.Location = New Point(59, 18)
.Location = New Point(39, 20)
End With

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.
Expand All @@ -166,18 +174,21 @@ Public Class Compact



Shared NonCompressableSet As New List(Of String)(Regex.Replace(My.Settings.NonCompressableList, "\s+", "").Split(";"c))



Public ListOfFiles As New List(Of String)
Dim FileIndex As Integer = 0

Private Sub GetFilesToCompress(ByVal targetDirectory As String, targetOutputList As List(Of String), LimitSelectedFiles As Boolean)

Dim NonCompressableSet As New List(Of String)(Regex.Replace(My.Settings.NonCompressableList, "\s+", "").Split(";"c))

Dim fileEntries As String() = Directory.GetFiles(targetDirectory)
Dim fileName As String ' Process the list of files found in the directory.

For Each fileName In fileEntries

If LimitSelectedFiles = True Then
If Path.GetExtension(fileName) = "" OrElse NonCompressableSet.Contains(Path.GetExtension(fileName).TrimStart(".").ToLowerInvariant) = False Then
targetOutputList.Add(fileName)
Expand Down Expand Up @@ -499,25 +510,24 @@ Public Class Compact



compRatioLabel.Text = Math.Round(SizeBeforeCompression / SizeAfterCompression, 1)
Dim compRatio = Math.Round(SizeBeforeCompression / SizeAfterCompression, 1)


spaceSavedLabel.Text = GetOutputSize((SizeBeforeCompression - SizeAfterCompression), True) + " Saved"
sb_SpaceSavedLabel.Text = spaceSavedLabel.Text

labelFilesCompressed.Text = numberFilesCompressed & " / " & AllFiles.Count & " files compressed"
help_resultsFilesCompressed.Location = New Point(labelFilesCompressed.Location.X + labelFilesCompressed.Width + 2, labelFilesCompressed.Location.Y + 1)


Try

compressedSizeVisual.Width = CInt(320 / compRatioLabel.Text)
sb_compressedSizeVisual.Height = CInt(113 / compRatioLabel.Text)
compressedSizeVisual.Width = CInt(320 / compRatio)
sb_compressedSizeVisual.Height = CInt(113 / compRatio)
sb_compressedSizeVisual.Location = New Point(sb_compressedSizeVisual.Location.X, 5 + 113 - sb_compressedSizeVisual.Height)

Callpercent = (CDec(1 - (SizeAfterCompression / SizeBeforeCompression))) * 100
If My.Settings.ShowNotifications Then _
TrayIcon.ShowBalloonTip(1, "Compressed: " & StrConv(sb_FolderName.Text, VbStrConv.ProperCase), vbCrLf & "▸ " & spaceSavedLabel.Text & vbCrLf & "▸ " & Math.Round(Callpercent, 1) & "% Smaller", ToolTipIcon.None)
TrayIcon.ShowBalloonTip(1, "Compressed: " & sb_FolderName.Text, vbCrLf & "▸ " & spaceSavedLabel.Text & vbCrLf & "▸ " & Math.Round(Callpercent, 1) & "% Smaller", ToolTipIcon.None)

Catch ex As OverflowException
compressedSizeVisual.Width = 320
Expand Down Expand Up @@ -884,6 +894,24 @@ Public Class Compact




Private Sub ListBox1_DrawItem(ByVal sender As Object, ByVal e As DrawItemEventArgs) Handles SelectedFiles.DrawItem
e.DrawBackground()
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)
End Sub

Private Sub ListBox1_MeasureItem(ByVal sender As Object, ByVal e As MeasureItemEventArgs) Handles SelectedFiles.MeasureItem
e.ItemHeight = 22
End Sub

Private Sub Panel1_Paint(sender As Object, e As PaintEventArgs) Handles Panel1.Paint
Dim p As New Pen(Brushes.Silver, 1)
e.Graphics.DrawLine(p, New Point(15, 0), New Point(Panel1.Width, 0))
End Sub




Private Sub dirChooser_MouseEnter(sender As Object, e As EventArgs) Handles dirChooser.MouseEnter
dirChooser.LinkColor = Color.FromArgb(200, 200, 200)
End Sub
Expand Down
4 changes: 2 additions & 2 deletions CompactGUI/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("2.5.1.0")>
<Assembly: AssemblyFileVersion("2.5.1.0")>
<Assembly: AssemblyVersion("2.6.0.0")>
<Assembly: AssemblyFileVersion("2.6.0.0")>
<Assembly: NeutralResourcesLanguage("en")>
Loading