From 10aa2f68de42186e15463334f52ecbfcef8447b9 Mon Sep 17 00:00:00 2001 From: ImminentFate Date: Fri, 2 Mar 2018 18:34:57 +1000 Subject: [PATCH 1/5] - 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 --- CompactGUI/Compact.Designer.vb | 136 ++---------------- CompactGUI/Compact.resx | 7 - CompactGUI/Compact.vb | 8 +- CompactGUI/WikiHandler.vb | 227 +++++++++++++++---------------- CompactGUI/WikiPopup.Designer.vb | 14 -- CompactGUI/WikiPopup.resx | 6 - CompactGUI/WikiSubmission.vb | 61 ++++++--- 7 files changed, 164 insertions(+), 295 deletions(-) diff --git a/CompactGUI/Compact.Designer.vb b/CompactGUI/Compact.Designer.vb index 5315d36..1fd604e 100644 --- a/CompactGUI/Compact.Designer.vb +++ b/CompactGUI/Compact.Designer.vb @@ -88,6 +88,7 @@ Partial Class Compact Me.ProgressPage = New System.Windows.Forms.TabPage() Me.TableLayoutPanel4 = New System.Windows.Forms.TableLayoutPanel() Me.CompResultsPanel = New System.Windows.Forms.Panel() + Me.results_arc = New CompactGUI.GraphicsPanel() Me.labelFilesCompressed = New System.Windows.Forms.Label() Me.dirChosenLabel = New System.Windows.Forms.Label() Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() @@ -102,20 +103,10 @@ Partial Class Compact Me.conOut = New System.Windows.Forms.ListBox() Me.returnArrow = New System.Windows.Forms.Label() Me.submitToWiki = New System.Windows.Forms.Label() - Me.TabPage3 = New System.Windows.Forms.TabPage() - Me.testFileArgs = New System.Windows.Forms.Button() - Me.Label10 = New System.Windows.Forms.Label() - Me.OldconOut = New System.Windows.Forms.RichTextBox() - Me.TextBox1 = New System.Windows.Forms.TextBox() - Me.testcompactargs = New System.Windows.Forms.Button() - Me.compRatioLabel = New System.Windows.Forms.Label() - Me.Button1 = New System.Windows.Forms.Button() - Me.Label12 = New System.Windows.Forms.Label() Me.spaceSavedLabel = New System.Windows.Forms.Label() Me.TrayIcon = New System.Windows.Forms.NotifyIcon(Me.components) Me.TrayMenu = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.Tray_ShowMain = New System.Windows.Forms.ToolStripMenuItem() - Me.results_arc = New CompactGUI.GraphicsPanel() Me.panel_topBar.SuspendLayout() Me.updateBanner.SuspendLayout() Me.topbar_dirchooserContainer.SuspendLayout() @@ -137,7 +128,6 @@ Partial Class Compact Me.compressedSizeVisual.SuspendLayout() Me.Panel5.SuspendLayout() Me.panel_console.SuspendLayout() - Me.TabPage3.SuspendLayout() Me.TrayMenu.SuspendLayout() Me.SuspendLayout() ' @@ -346,7 +336,6 @@ Partial Class Compact Me.seecompest.Size = New System.Drawing.Size(16, 13) Me.seecompest.TabIndex = 21 Me.seecompest.Text = "❯ " - Me.ToolTipFilesCompressed.SetToolTip(Me.seecompest, resources.GetString("seecompest.ToolTip")) Me.seecompest.Visible = False ' 'ToolTipFilesCompressed @@ -733,7 +722,6 @@ Partial Class Compact Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.TabControl1.Controls.Add(Me.InputPage) Me.TabControl1.Controls.Add(Me.ProgressPage) - Me.TabControl1.Controls.Add(Me.TabPage3) Me.TabControl1.Location = New System.Drawing.Point(0, 116) Me.TabControl1.MinimumSize = New System.Drawing.Size(503, 200) Me.TabControl1.Name = "TabControl1" @@ -978,6 +966,13 @@ Partial Class Compact Me.CompResultsPanel.TabIndex = 31 Me.CompResultsPanel.Visible = False ' + 'results_arc + ' + Me.results_arc.Location = New System.Drawing.Point(13, 63) + Me.results_arc.Name = "results_arc" + Me.results_arc.Size = New System.Drawing.Size(265, 122) + Me.results_arc.TabIndex = 35 + ' 'labelFilesCompressed ' Me.labelFilesCompressed.AutoSize = True @@ -1147,103 +1142,6 @@ Partial Class Compact Me.submitToWiki.Text = "❯ Submit Results to Wiki" Me.submitToWiki.Visible = False ' - 'TabPage3 - ' - Me.TabPage3.Controls.Add(Me.testFileArgs) - Me.TabPage3.Controls.Add(Me.Label10) - Me.TabPage3.Controls.Add(Me.OldconOut) - Me.TabPage3.Controls.Add(Me.TextBox1) - Me.TabPage3.Controls.Add(Me.testcompactargs) - Me.TabPage3.Controls.Add(Me.compRatioLabel) - Me.TabPage3.Controls.Add(Me.Button1) - Me.TabPage3.Controls.Add(Me.Label12) - Me.TabPage3.Location = New System.Drawing.Point(4, 22) - Me.TabPage3.Name = "TabPage3" - Me.TabPage3.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage3.Size = New System.Drawing.Size(995, 509) - Me.TabPage3.TabIndex = 2 - Me.TabPage3.Text = "TabPage3" - Me.TabPage3.UseVisualStyleBackColor = True - ' - 'testFileArgs - ' - Me.testFileArgs.Location = New System.Drawing.Point(278, 74) - Me.testFileArgs.Name = "testFileArgs" - Me.testFileArgs.Size = New System.Drawing.Size(75, 23) - Me.testFileArgs.TabIndex = 29 - Me.testFileArgs.Text = "Test FileArgs" - Me.testFileArgs.UseVisualStyleBackColor = True - ' - 'Label10 - ' - Me.Label10.AutoSize = True - Me.Label10.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label10.ForeColor = System.Drawing.SystemColors.HotTrack - Me.Label10.Location = New System.Drawing.Point(10, 24) - Me.Label10.Name = "Label10" - Me.Label10.Size = New System.Drawing.Size(171, 25) - Me.Label10.TabIndex = 23 - Me.Label10.Text = "Testing Grounds" - ' - 'OldconOut - ' - Me.OldconOut.BackColor = System.Drawing.Color.White - Me.OldconOut.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.OldconOut.ForeColor = System.Drawing.Color.DimGray - Me.OldconOut.Location = New System.Drawing.Point(32, 308) - Me.OldconOut.Name = "OldconOut" - Me.OldconOut.ReadOnly = True - Me.OldconOut.Size = New System.Drawing.Size(375, 161) - Me.OldconOut.TabIndex = 0 - Me.OldconOut.Text = "" - Me.OldconOut.Visible = False - ' - 'TextBox1 - ' - Me.TextBox1.Location = New System.Drawing.Point(32, 243) - Me.TextBox1.Name = "TextBox1" - Me.TextBox1.Size = New System.Drawing.Size(340, 20) - Me.TextBox1.TabIndex = 1 - ' - 'testcompactargs - ' - Me.testcompactargs.Location = New System.Drawing.Point(32, 75) - Me.testcompactargs.Name = "testcompactargs" - Me.testcompactargs.Size = New System.Drawing.Size(113, 23) - Me.testcompactargs.TabIndex = 28 - Me.testcompactargs.Text = "Test CompactArgs" - Me.testcompactargs.UseVisualStyleBackColor = True - ' - 'compRatioLabel - ' - Me.compRatioLabel.AutoSize = True - Me.compRatioLabel.Font = New System.Drawing.Font("Segoe UI", 12.0!) - Me.compRatioLabel.Location = New System.Drawing.Point(28, 178) - Me.compRatioLabel.Name = "compRatioLabel" - Me.compRatioLabel.Size = New System.Drawing.Size(85, 21) - Me.compRatioLabel.TabIndex = 27 - Me.compRatioLabel.Text = "compRatio" - Me.compRatioLabel.Visible = False - ' - 'Button1 - ' - Me.Button1.Location = New System.Drawing.Point(378, 243) - Me.Button1.Name = "Button1" - Me.Button1.Size = New System.Drawing.Size(75, 23) - Me.Button1.TabIndex = 2 - Me.Button1.Text = "SendCMD" - Me.Button1.UseVisualStyleBackColor = True - ' - 'Label12 - ' - Me.Label12.AutoSize = True - Me.Label12.Location = New System.Drawing.Point(29, 156) - Me.Label12.Name = "Label12" - Me.Label12.Size = New System.Drawing.Size(35, 13) - Me.Label12.TabIndex = 26 - Me.Label12.Text = "Ratio:" - Me.Label12.Visible = False - ' 'spaceSavedLabel ' Me.spaceSavedLabel.AutoSize = True @@ -1277,13 +1175,6 @@ Partial Class Compact Me.Tray_ShowMain.Size = New System.Drawing.Size(78, 22) Me.Tray_ShowMain.Text = "Show" ' - 'results_arc - ' - Me.results_arc.Location = New System.Drawing.Point(13, 63) - Me.results_arc.Name = "results_arc" - Me.results_arc.Size = New System.Drawing.Size(265, 122) - Me.results_arc.TabIndex = 35 - ' 'Compact ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -1329,8 +1220,6 @@ Partial Class Compact Me.Panel5.ResumeLayout(False) Me.Panel5.PerformLayout() Me.panel_console.ResumeLayout(False) - Me.TabPage3.ResumeLayout(False) - Me.TabPage3.PerformLayout() Me.TrayMenu.ResumeLayout(False) Me.ResumeLayout(False) Me.PerformLayout() @@ -1403,15 +1292,6 @@ Partial Class Compact Friend WithEvents spaceSavedLabel As Label Friend WithEvents btnUncompress As Button Friend WithEvents sb_progresspercent As Label - Friend WithEvents TabPage3 As TabPage - Friend WithEvents testFileArgs As Button - Friend WithEvents Label10 As Label - Friend WithEvents OldconOut As RichTextBox - Friend WithEvents TextBox1 As TextBox - Friend WithEvents testcompactargs As Button - Friend WithEvents compRatioLabel As Label - Friend WithEvents Button1 As Button - Friend WithEvents Label12 As Label Friend WithEvents sb_lblGameIssues As Label Friend WithEvents sb_AnalysisPanel As Panel Friend WithEvents sb_ResultsPanel As Panel diff --git a/CompactGUI/Compact.resx b/CompactGUI/Compact.resx index 8cd12f6..45aad7e 100644 --- a/CompactGUI/Compact.resx +++ b/CompactGUI/Compact.resx @@ -129,13 +129,6 @@ 460, 17 - - For games that contain files >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. - - 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. diff --git a/CompactGUI/Compact.vb b/CompactGUI/Compact.vb index 868d319..b5a82a3 100644 --- a/CompactGUI/Compact.vb +++ b/CompactGUI/Compact.vb @@ -499,7 +499,7 @@ Public Class Compact - compRatioLabel.Text = Math.Round(SizeBeforeCompression / SizeAfterCompression, 1) + Dim compRatio = Math.Round(SizeBeforeCompression / SizeAfterCompression, 1) spaceSavedLabel.Text = GetOutputSize((SizeBeforeCompression - SizeAfterCompression), True) + " Saved" @@ -511,13 +511,13 @@ Public Class Compact 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 diff --git a/CompactGUI/WikiHandler.vb b/CompactGUI/WikiHandler.vb index cc54386..8136013 100644 --- a/CompactGUI/WikiHandler.vb +++ b/CompactGUI/WikiHandler.vb @@ -5,21 +5,23 @@ Imports System.Text Imports System.Text.RegularExpressions Class WikiHandler - Shared InputFromGitHub() As String + Shared InputFromGitHub As IEnumerable(Of XElement) + Friend Shared allResults As New List(Of Result) Shared workingname As String = "testdir" Private Shared Sub WikiParser() Console.WriteLine("Working Name: " & workingname) - Dim Source As String + allResults.Clear() + Dim SRC As XElement If InputFromGitHub Is Nothing Then Console.WriteLine("Getting List") Dim wc = New WebClient With {.Encoding = Encoding.UTF8} Try - Source = wc.DownloadString("https://raw.githubusercontent.com/ImminentFate/CompactGUI/master/Wiki/WikiDB_Games") - InputFromGitHub = Source.TrimEnd().Split(vbLf) + SRC = XElement.Parse(wc.DownloadString("https://raw.githubusercontent.com/ImminentFate/CompactGUI/master/Wiki/Database.xml")) + InputFromGitHub = SRC.Elements() ParseData() Catch ex As WebException @@ -39,94 +41,57 @@ Class WikiHandler End Sub Private Shared Sub ParseData() - Dim gameName As New List(Of String) + For Each result In InputFromGitHub + Dim itemName As String = result.Element("itemName").Value + Dim itemFolder As String = result.Element("itemFolder").Value + Dim itemSteamID As String = result.Element("itemSteamID").Value + Dim itemAlgorithm As String = result.Element("itemAlgorithm").Value + Dim itemBeforeSize As UInt64 = result.Element("itemBefore").Value + Dim itemAfterSize As UInt64 = result.Element("itemAfter").Value - For Each s As String In InputFromGitHub - gameName.Add(s.Split("|")(2)) - Next - - - Dim strippedgameName As New List(Of String) + Dim res As New Result(itemName, itemFolder, itemSteamID, itemAlgorithm, itemBeforeSize, itemAfterSize) - - For Each s In gameName - Dim n = Regex.Replace(s, "[^\p{L}a-zA-Z0-90]", "") - strippedgameName.Add(n.ToLower.Trim) - Next + allResults.Add(res) + Next result + Dim gcount As New List(Of Result) - Dim gcount As New List(Of Integer) - If ParseLogic(strippedgameName, workingname) = True Then - Dim i = 0 - If isExactMatch = True Then - For Each a In strippedgameName - If a.Equals(workingname) And workingname.Length > 1 Then gcount.Add(i) - i += 1 - Next - Else - For Each a In strippedgameName - If a.ToString.StartsWith(workingname) And Math.Abs(a.ToString.Length - workingname.Length) < 5 And workingname.Length > 1 Then gcount.Add(i) - i += 1 - Next + Dim matches As Integer = 0 + For Each r As Result In allResults + If r.Folder.Equals(workingname) Then + gcount.Add(r) + matches += 1 End If - Else - Dim i = 0 - For Each a In strippedgameName - If workingname.Length > 5 Then - If a.ToString.Contains(workingname) Then gcount.Add(i) + Next + Console.WriteLine(vbCrLf) + If matches = 0 Then + For Each r As Result In allResults + If r.Name_Sanitised.Contains(workingname) Then + gcount.Add(r) + matches += 1 End If - i += 1 + Next End If - WikiPopup.GamesTable.Visible = False - WikiPopup.GamesTable.Controls.Clear() - WikiPopup.GamesTable.RowCount = 0 - - Dim provider As CultureInfo = New CultureInfo("en-US") - - Dim GName As New Label With {.Text = "Game"} - Dim GSizeU As New Label With {.Text = "Before"} - Dim GSizeC As New Label With {.Text = "After"} - Dim GCompR As New Label With {.Text = "Ratio"} - Dim GCompAlg As New Label With {.Text = "Algorithm"} - - - WikiPopup.GamesTable.RowStyles.Add(New RowStyle(SizeType.Absolute, 35)) - WikiPopup.GamesTable.RowCount += 1 - WikiPopup.GamesTable.Controls.Add(GName, 0, WikiPopup.GamesTable.RowCount - 1) - WikiPopup.GamesTable.Controls.Add(GSizeU, 1, WikiPopup.GamesTable.RowCount - 1) - WikiPopup.GamesTable.Controls.Add(GSizeC, 2, WikiPopup.GamesTable.RowCount - 1) - WikiPopup.GamesTable.Controls.Add(GCompR, 3, WikiPopup.GamesTable.RowCount - 1) - WikiPopup.GamesTable.Controls.Add(GCompAlg, 4, WikiPopup.GamesTable.RowCount - 1) - - For Each WikiHeader As Label In WikiPopup.GamesTable.Controls - WikiHeader.Font = New Font("Segoe UI", 11, FontStyle.Bold) - WikiHeader.Dock = DockStyle.Right - Next + Dim ratioavg As Decimal = 1 + firstGame = 0 - GName.Dock = DockStyle.Left + PrepareTable() - Dim ratioavg As Decimal = 1 - firstGame = 0 + For Each r In gcount + FillTable(r) - For Each n In gcount - FillTable(n) + ratioavg += Decimal.Parse(r.Ratio) - ratioavg += Decimal.Parse(InputFromGitHub(n).Split("|")(6), provider) + Compact.sb_lblGameIssues.Visible = False 'Add check for game issues at later date - If InputFromGitHub(n).Split("|")(7).Contains("*") Then - Compact.sb_lblGameIssues.Visible = True - Compact.sb_lblGameIssues.Text = "! Game has issues" - Else - Compact.sb_lblGameIssues.Visible = False - End If Next Compact.sb_labelCompressed.Text = "Estimated Compressed" @@ -160,58 +125,69 @@ Class WikiHandler End Sub + Private Shared Sub PrepareTable() + WikiPopup.GamesTable.Visible = False + WikiPopup.GamesTable.Controls.Clear() + WikiPopup.GamesTable.RowCount = 0 + Dim provider As CultureInfo = New CultureInfo("en-US") - Shared isExactMatch As Boolean - Shared Function ParseLogic(online_R As List(Of String), local_R As String) As Boolean - isExactMatch = False - Dim success = 0 - For Each a In online_R - If a.StartsWith(local_R) And Math.Abs(a.Length - workingname.Length) < 5 Then - If a.Length = workingname.Length Then isExactMatch = True - success = 1 - Return True - Exit For - End If - Next + Dim GName As New Label With {.Text = "Game"} + Dim GSizeU As New Label With {.Text = "Before"} + Dim GSizeC As New Label With {.Text = "After"} + Dim GCompR As New Label With {.Text = "Ratio"} + Dim GCompAlg As New Label With {.Text = "Algorithm"} + Console.WriteLine(WikiPopup.GamesTable.RowCount) + + WikiPopup.GamesTable.RowStyles.Add(New RowStyle(SizeType.Absolute, 35)) + WikiPopup.GamesTable.RowCount += 1 + WikiPopup.GamesTable.Controls.Add(GName, 0, WikiPopup.GamesTable.RowCount - 1) + WikiPopup.GamesTable.Controls.Add(GSizeU, 1, WikiPopup.GamesTable.RowCount - 1) + WikiPopup.GamesTable.Controls.Add(GSizeC, 2, WikiPopup.GamesTable.RowCount - 1) + WikiPopup.GamesTable.Controls.Add(GCompR, 3, WikiPopup.GamesTable.RowCount - 1) + WikiPopup.GamesTable.Controls.Add(GCompAlg, 4, WikiPopup.GamesTable.RowCount - 1) - If success = 0 Then Return False + For Each WikiHeader As Label In WikiPopup.GamesTable.Controls + WikiHeader.Font = New Font("Segoe UI", 11, FontStyle.Bold) + WikiHeader.Dock = DockStyle.Right + Next - End Function + GName.Dock = DockStyle.Left + End Sub Shared firstGame As Integer = 0 - Private Shared Sub FillTable(ps As Integer) + Private Shared Sub FillTable(ps As Result) If firstGame = 0 Then - Compact.sb_FolderName.Text = InputFromGitHub(ps).Split("|")(2) + Compact.sb_FolderName.Text = ps.Name firstGame = 1 End If Dim GName As New Label With { - .Text = InputFromGitHub(ps).Split("|")(2), .ForeColor = Color.DimGray, + .Text = ps.Name, .ForeColor = Color.DimGray, .Dock = DockStyle.Left, .Font = New Font("Segoe UI", 11, FontStyle.Regular) } Dim GSizeU As New Label With { - .Text = InputFromGitHub(ps).Split("|")(3), .ForeColor = Color.DimGray, + .Text = ps.BeforeSize_Formatted, .ForeColor = Color.DimGray, .Dock = DockStyle.Right, .Font = New Font("Segoe UI", 10, FontStyle.Regular) } Dim GSizeC As New Label With { - .Text = InputFromGitHub(ps).Split("|")(4), .ForeColor = Color.DimGray, + .Text = ps.AfterSize_Formatted, .ForeColor = Color.DimGray, .Dock = DockStyle.Right, .Font = New Font("Segoe UI", 10, FontStyle.Regular) } Dim GCompR As New Label With { - .Text = InputFromGitHub(ps).Split("|")(6), .ForeColor = Color.DimGray, + .Text = ps.Ratio, .ForeColor = Color.DimGray, .Dock = DockStyle.Right, .Font = New Font("Segoe UI", 10, FontStyle.Regular) } Dim GCompAlg As New Label With { - .Text = InputFromGitHub(ps).Split("|")(1), .ForeColor = Color.DimGray, + .Text = ps.Algorithm, .ForeColor = Color.DimGray, .Dock = DockStyle.Right, .Font = New Font("Segoe UI", 10, FontStyle.Regular) } @@ -243,29 +219,8 @@ Class WikiHandler Dim wnpatch As String = Regex.Replace(DIwDString.Name.ToString, "[^\p{L}a-zA-Z0-90]", "").ToLower.Trim() - Select Case True - Case wnpatch.Contains("callofduty") - workingname = wnpatch.Replace("callofduty", "cod") - If workingname.EndsWith("Modernwarfare") Then workingname = "cod4" - - Case wnpatch.Contains("gameoftheyear") - workingname = wnpatch.Replace("gameoftheyear", "goty") - - Case wnpatch.Contains("age2hd") - workingname = "ageofempiresiihd" + workingname = wnpatch - Case wnpatch.Contains("shadowofmordor") - workingname = "middleearthshadowofmordor" - - Case wnpatch.Contains("shadowofwar") - workingname = "middleearthshadowofwar" - - Case wnpatch.Contains("pubg") - workingname = "playerunknownsbattlegrounds" - - Case Else - workingname = wnpatch - End Select folderSize = Math.Round(Decimal.Parse(rawPreSize.Split(" ")(0)), 2) suffix = rawPreSize.Split(" ")(1) @@ -316,3 +271,45 @@ Class WikiHandler End Class + + + +Public Class Result + + Property Name As String + Property Name_Sanitised As String + Property Folder As String + Property SteamID As Integer + Property Algorithm As String + Property BeforeSize As UInt64 + Property BeforeSize_Formatted As String + Property AfterSize As UInt64 + Property AfterSize_Formatted As String + Property Ratio As Decimal + + Public ReadOnly Property AllData() + Get + Return Name & Folder & SteamID & Algorithm & AfterSize + End Get + End Property + + Public Sub New(ByVal nm As String, + ByVal fl As String, + ByVal stID As Integer, + ByVal alg As String, + ByVal bef As UInt64, + ByVal aft As UInt64) + + Name = nm + Name_Sanitised = Regex.Replace(nm.ToLower, "[^\p{L}a-zA-Z0-90]", "") + Folder = Regex.Replace(fl.ToLower, "[^\p{L}a-zA-Z0-90]", "") + SteamID = stID + Algorithm = alg + BeforeSize = bef + BeforeSize_Formatted = Compact.GetOutputSize(bef, True) + AfterSize = aft + AfterSize_Formatted = Compact.GetOutputSize(aft, True) + Ratio = Math.Round(AfterSize / BeforeSize, 2) + End Sub + +End Class diff --git a/CompactGUI/WikiPopup.Designer.vb b/CompactGUI/WikiPopup.Designer.vb index bda5286..1021930 100644 --- a/CompactGUI/WikiPopup.Designer.vb +++ b/CompactGUI/WikiPopup.Designer.vb @@ -27,7 +27,6 @@ Partial Class WikiPopup Me.GamesTable = New System.Windows.Forms.TableLayoutPanel() Me.Label1 = New System.Windows.Forms.Label() Me.Panel1 = New System.Windows.Forms.Panel() - Me.Label2 = New System.Windows.Forms.Label() Me.ImportantToolTip = New System.Windows.Forms.ToolTip(Me.components) Me.Panel1.SuspendLayout() Me.SuspendLayout() @@ -68,7 +67,6 @@ Partial Class WikiPopup ' Me.Panel1.BackColor = System.Drawing.Color.Transparent Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.Panel1.Controls.Add(Me.Label2) Me.Panel1.Controls.Add(Me.Label1) Me.Panel1.Controls.Add(Me.GamesTable) Me.Panel1.Dock = System.Windows.Forms.DockStyle.Fill @@ -78,17 +76,6 @@ Partial Class WikiPopup Me.Panel1.Size = New System.Drawing.Size(430, 375) Me.Panel1.TabIndex = 9 ' - 'Label2 - ' - Me.Label2.ForeColor = System.Drawing.Color.IndianRed - Me.Label2.Location = New System.Drawing.Point(160, 18) - Me.Label2.Name = "Label2" - Me.Label2.Size = New System.Drawing.Size(247, 48) - Me.Label2.TabIndex = 9 - Me.Label2.Text = "Hover over this text to see an important note" - Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - Me.ImportantToolTip.SetToolTip(Me.Label2, resources.GetString("Label2.ToolTip")) - ' 'ImportantToolTip ' Me.ImportantToolTip.AutomaticDelay = 100 @@ -123,6 +110,5 @@ Partial Class WikiPopup Friend WithEvents GamesTable As TableLayoutPanel Friend WithEvents Label1 As Label Friend WithEvents Panel1 As Panel - Friend WithEvents Label2 As Label Friend WithEvents ImportantToolTip As ToolTip End Class diff --git a/CompactGUI/WikiPopup.resx b/CompactGUI/WikiPopup.resx index 938f784..ba5b023 100644 --- a/CompactGUI/WikiPopup.resx +++ b/CompactGUI/WikiPopup.resx @@ -120,12 +120,6 @@ 17, 17 - - For games that contain files >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. - diff --git a/CompactGUI/WikiSubmission.vb b/CompactGUI/WikiSubmission.vb index 421e0f1..1b9c624 100644 --- a/CompactGUI/WikiSubmission.vb +++ b/CompactGUI/WikiSubmission.vb @@ -108,40 +108,59 @@ Assignment: Else - Name_Submit = HttpUtility.UrlPathEncode(txtbox_Name.Text.Trim()) - Folder_Submit = HttpUtility.UrlPathEncode(Folder_Submit) - SteamID_Submit = txtbox_SteamID.Text - UniqueID_Submit = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(getMacAddress())) + PrepareSubmission() - Console.WriteLine(Name_Submit) - FillDataCollection() - - Dim URL_First As String = "https://docs.google.com/forms/d/e/1FAIpQLSfAzlQAhyPEueFyQiTEmpudcKaVLnpRPmzrIuBZxnR8f7PjPg/formResponse?&ifq&entry.630201004=%3CCompactGUI%3E" + End If - Dim URL_Last As String = "&submit=Submit" + ElseIf TabControl1.SelectedTab Is Page3 Then + Me.Close() + End If - Dim URL_All As String = URL_First & UniqueID_Submit & "%7C" & Type_Submit & "%7C" & Name_Submit & "%7C" & Folder_Submit & "%7C" & SteamID_Submit & "%7C" & CompMode_Submit & "%7C" & BeforeSize_Submit & "%7C" & AfterSize_Submit & URL_Last - lbl_Title.Text = "Sending Results" - Panel1.Refresh() - SendPageRequest(URL_All) + End Sub - lbl_Title.Text = "Results Sent" - TabControl1.SelectedTab = Page3 - btn_NextPage.Text = "Close" - btn_Cancel.Visible = False + Private Sub PrepareSubmission() + Dim alreadyExists As Boolean + For Each res As Result In WikiHandler.allResults + If CInt(txtbox_SteamID.Value) = If(res.SteamID = 0, 999999, res.SteamID) OrElse Folder_Submit = res.Folder OrElse txtbox_Name.Text.Trim() = res.Name Then + If CompMode_Submit = res.Algorithm Then + If BeforeSize_Submit >= res.BeforeSize * 0.92 AndAlso BeforeSize_Submit <= res.BeforeSize * 1.08 Then + alreadyExists = True + End If + End If End If + Next - ElseIf TabControl1.SelectedTab Is Page3 Then - Me.Close() - End If + Name_Submit = HttpUtility.UrlPathEncode(txtbox_Name.Text.Trim()) + Folder_Submit = HttpUtility.UrlPathEncode(Folder_Submit) + SteamID_Submit = txtbox_SteamID.Text + UniqueID_Submit = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(getMacAddress())) - End Sub + FillDataCollection() + + + If alreadyExists = False Then + Dim URL_First As String = "https://docs.google.com/forms/d/e/1FAIpQLSfAzlQAhyPEueFyQiTEmpudcKaVLnpRPmzrIuBZxnR8f7PjPg/formResponse?&ifq&entry.630201004=%3CCompactGUI%3E" + + Dim URL_Last As String = "&submit=Submit" + Dim URL_All As String = URL_First & UniqueID_Submit & "%7C" & Type_Submit & "%7C" & Name_Submit & "%7C" & Folder_Submit & "%7C" & SteamID_Submit & "%7C" & CompMode_Submit & "%7C" & BeforeSize_Submit & "%7C" & AfterSize_Submit & URL_Last + lbl_Title.Text = "Sending Results" + Panel1.Refresh() + SendPageRequest(URL_All) + Else + + End If + + lbl_Title.Text = "Results Sent" + TabControl1.SelectedTab = Page3 + btn_NextPage.Text = "Close" + btn_Cancel.Visible = False + End Sub Private Sub SendPageRequest(ByVal URL As String, Optional ByVal proxy As Net.WebProxy = Nothing) Try From cf21470ebda93545f42893fd2d4f567a60da2000 Mon Sep 17 00:00:00 2001 From: ImminentFate Date: Fri, 2 Mar 2018 19:00:41 +1000 Subject: [PATCH 2/5] - Bumped version - Renamed arguments + disabled "Compress Subfolders" option. --- CompactGUI/Compact.Designer.vb | 25 +++++++++++++------------ CompactGUI/Compact.vb | 3 +-- CompactGUI/My Project/AssemblyInfo.vb | 4 ++-- Version.xml | 12 ++++++------ 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/CompactGUI/Compact.Designer.vb b/CompactGUI/Compact.Designer.vb index 1fd604e..ed877b1 100644 --- a/CompactGUI/Compact.Designer.vb +++ b/CompactGUI/Compact.Designer.vb @@ -88,7 +88,6 @@ Partial Class Compact Me.ProgressPage = New System.Windows.Forms.TabPage() Me.TableLayoutPanel4 = New System.Windows.Forms.TableLayoutPanel() Me.CompResultsPanel = New System.Windows.Forms.Panel() - Me.results_arc = New CompactGUI.GraphicsPanel() Me.labelFilesCompressed = New System.Windows.Forms.Label() Me.dirChosenLabel = New System.Windows.Forms.Label() Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() @@ -107,6 +106,7 @@ Partial Class Compact Me.TrayIcon = New System.Windows.Forms.NotifyIcon(Me.components) Me.TrayMenu = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.Tray_ShowMain = New System.Windows.Forms.ToolStripMenuItem() + Me.results_arc = New CompactGUI.GraphicsPanel() Me.panel_topBar.SuspendLayout() Me.updateBanner.SuspendLayout() Me.topbar_dirchooserContainer.SuspendLayout() @@ -639,10 +639,10 @@ Partial Class Compact Me.sb_FolderName.BackColor = System.Drawing.Color.Transparent Me.sb_FolderName.Font = New System.Drawing.Font("Segoe UI", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.sb_FolderName.ForeColor = System.Drawing.Color.White - Me.sb_FolderName.Location = New System.Drawing.Point(0, 27) + Me.sb_FolderName.Location = New System.Drawing.Point(0, 17) Me.sb_FolderName.Name = "sb_FolderName" Me.sb_FolderName.Padding = New System.Windows.Forms.Padding(10, 0, 10, 0) - Me.sb_FolderName.Size = New System.Drawing.Size(354, 30) + Me.sb_FolderName.Size = New System.Drawing.Size(354, 60) Me.sb_FolderName.TabIndex = 6 Me.sb_FolderName.Text = "Portal 2" Me.sb_FolderName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter @@ -897,9 +897,9 @@ Partial Class Compact Me.checkHiddenFiles.ForeColor = System.Drawing.Color.FromArgb(CType(CType(48, Byte), Integer), CType(CType(67, Byte), Integer), CType(CType(84, Byte), Integer)) Me.checkHiddenFiles.Location = New System.Drawing.Point(37, 98) Me.checkHiddenFiles.Name = "checkHiddenFiles" - Me.checkHiddenFiles.Size = New System.Drawing.Size(204, 17) + Me.checkHiddenFiles.Size = New System.Drawing.Size(192, 17) Me.checkHiddenFiles.TabIndex = 6 - Me.checkHiddenFiles.Text = "Action on Hidden and System Files" + Me.checkHiddenFiles.Text = "Process Hidden and System Files" Me.checkHiddenFiles.UseVisualStyleBackColor = True ' 'checkRecursiveScan @@ -907,6 +907,7 @@ Partial Class Compact Me.checkRecursiveScan.AutoSize = True Me.checkRecursiveScan.Checked = True Me.checkRecursiveScan.CheckState = System.Windows.Forms.CheckState.Checked + Me.checkRecursiveScan.Enabled = False Me.checkRecursiveScan.Font = New System.Drawing.Font("Segoe UI", 8.25!) Me.checkRecursiveScan.ForeColor = System.Drawing.Color.FromArgb(CType(CType(48, Byte), Integer), CType(CType(67, Byte), Integer), CType(CType(84, Byte), Integer)) Me.checkRecursiveScan.Location = New System.Drawing.Point(37, 38) @@ -966,13 +967,6 @@ Partial Class Compact Me.CompResultsPanel.TabIndex = 31 Me.CompResultsPanel.Visible = False ' - 'results_arc - ' - Me.results_arc.Location = New System.Drawing.Point(13, 63) - Me.results_arc.Name = "results_arc" - Me.results_arc.Size = New System.Drawing.Size(265, 122) - Me.results_arc.TabIndex = 35 - ' 'labelFilesCompressed ' Me.labelFilesCompressed.AutoSize = True @@ -1175,6 +1169,13 @@ Partial Class Compact Me.Tray_ShowMain.Size = New System.Drawing.Size(78, 22) Me.Tray_ShowMain.Text = "Show" ' + 'results_arc + ' + Me.results_arc.Location = New System.Drawing.Point(13, 63) + Me.results_arc.Name = "results_arc" + Me.results_arc.Size = New System.Drawing.Size(265, 122) + Me.results_arc.TabIndex = 35 + ' 'Compact ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) diff --git a/CompactGUI/Compact.vb b/CompactGUI/Compact.vb index b5a82a3..4c5ff2a 100644 --- a/CompactGUI/Compact.vb +++ b/CompactGUI/Compact.vb @@ -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) diff --git a/CompactGUI/My Project/AssemblyInfo.vb b/CompactGUI/My Project/AssemblyInfo.vb index f9dc23d..7cd95f4 100644 --- a/CompactGUI/My Project/AssemblyInfo.vb +++ b/CompactGUI/My Project/AssemblyInfo.vb @@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices ' by using the '*' as shown below: ' - - + + diff --git a/Version.xml b/Version.xml index 18cb245..5bf5b94 100644 --- a/Version.xml +++ b/Version.xml @@ -1,9 +1,9 @@ - 2.5 - 1 + 2.6 + 0 False - V2.5.1 - 2.5.1 - Added more filetypes to the default filter. - Capitalised extensions (e.g. .ZIP vs .zip) are now caught by the non-compressable filter. + V2.6.0 + 2.6.0 + Reworked Wiki Parser to be compatible with new database. | Added check to avoid duplicate submissions of results + Removed redundant code From c89168fa34b2fc4c437307b630e60c7f0d0e2e5f Mon Sep 17 00:00:00 2001 From: ImminentFate Date: Fri, 2 Mar 2018 19:08:28 +1000 Subject: [PATCH 3/5] - Moved title --- CompactGUI/Compact.Designer.vb | 8 ++++---- CompactGUI/Compact.vb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CompactGUI/Compact.Designer.vb b/CompactGUI/Compact.Designer.vb index ed877b1..4de9fc9 100644 --- a/CompactGUI/Compact.Designer.vb +++ b/CompactGUI/Compact.Designer.vb @@ -140,7 +140,7 @@ Partial Class Compact Me.topbar_title.AutoSize = True Me.topbar_title.Font = New System.Drawing.Font("Segoe UI Semilight", 15.75!) Me.topbar_title.ForeColor = System.Drawing.Color.White - Me.topbar_title.Location = New System.Drawing.Point(59, 18) + Me.topbar_title.Location = New System.Drawing.Point(39, 20) Me.topbar_title.Name = "topbar_title" Me.topbar_title.Size = New System.Drawing.Size(136, 30) Me.topbar_title.TabIndex = 13 @@ -180,7 +180,7 @@ Partial Class Compact 'updateBanner ' Me.updateBanner.Anchor = System.Windows.Forms.AnchorStyles.Top - Me.updateBanner.BackColor = System.Drawing.Color.FromArgb(CType(CType(211, Byte), Integer), CType(CType(84, Byte), Integer), CType(CType(0, Byte), Integer)) + Me.updateBanner.BackColor = System.Drawing.Color.FromArgb(CType(CType(39, Byte), Integer), CType(CType(174, Byte), Integer), CType(CType(96, Byte), Integer)) Me.updateBanner.Controls.Add(Me.dlUpdateLink) Me.updateBanner.Location = New System.Drawing.Point(310, 0) Me.updateBanner.Name = "updateBanner" @@ -200,7 +200,7 @@ Partial Class Compact Me.dlUpdateLink.Size = New System.Drawing.Size(380, 18) Me.dlUpdateLink.TabIndex = 1 Me.dlUpdateLink.TabStop = True - Me.dlUpdateLink.Text = "Update Available: Click to download V2.3" + Me.dlUpdateLink.Text = "Update Available: Click to download V2.X" Me.dlUpdateLink.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' 'btnAnalyze @@ -315,7 +315,7 @@ Partial Class Compact 'topbar_icon ' Me.topbar_icon.Image = Global.CompactGUI.My.Resources.Resources.iconbright - Me.topbar_icon.Location = New System.Drawing.Point(19, 19) + Me.topbar_icon.Location = New System.Drawing.Point(11, 25) Me.topbar_icon.Name = "topbar_icon" Me.topbar_icon.Size = New System.Drawing.Size(25, 25) Me.topbar_icon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom diff --git a/CompactGUI/Compact.vb b/CompactGUI/Compact.vb index 4c5ff2a..e0f7f3d 100644 --- a/CompactGUI/Compact.vb +++ b/CompactGUI/Compact.vb @@ -150,7 +150,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. From 7a297f2f05c700c5e8a84e6bf2f5826d68c28634 Mon Sep 17 00:00:00 2001 From: ImminentFate Date: Fri, 2 Mar 2018 19:11:07 +1000 Subject: [PATCH 4/5] - Removed redundant label --- CompactGUI/Compact.Designer.vb | 31 ++++++++----------------------- CompactGUI/Compact.vb | 1 - Version.xml | 2 +- 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/CompactGUI/Compact.Designer.vb b/CompactGUI/Compact.Designer.vb index 4de9fc9..0ec2768 100644 --- a/CompactGUI/Compact.Designer.vb +++ b/CompactGUI/Compact.Designer.vb @@ -52,7 +52,6 @@ Partial Class Compact Me.Label3 = New System.Windows.Forms.Label() Me.sb_compressedSizeVisual = New System.Windows.Forms.Panel() Me.Panel6 = New System.Windows.Forms.Panel() - Me.sb_SpaceSavedLabel = New System.Windows.Forms.Label() Me.sb_AnalysisPanel = New System.Windows.Forms.Panel() Me.sb_progresslabel = New System.Windows.Forms.Label() Me.sb_progressbar = New System.Windows.Forms.Panel() @@ -88,6 +87,7 @@ Partial Class Compact Me.ProgressPage = New System.Windows.Forms.TabPage() Me.TableLayoutPanel4 = New System.Windows.Forms.TableLayoutPanel() Me.CompResultsPanel = New System.Windows.Forms.Panel() + Me.results_arc = New CompactGUI.GraphicsPanel() Me.labelFilesCompressed = New System.Windows.Forms.Label() Me.dirChosenLabel = New System.Windows.Forms.Label() Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() @@ -106,7 +106,6 @@ Partial Class Compact Me.TrayIcon = New System.Windows.Forms.NotifyIcon(Me.components) Me.TrayMenu = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.Tray_ShowMain = New System.Windows.Forms.ToolStripMenuItem() - Me.results_arc = New CompactGUI.GraphicsPanel() Me.panel_topBar.SuspendLayout() Me.updateBanner.SuspendLayout() Me.topbar_dirchooserContainer.SuspendLayout() @@ -449,7 +448,6 @@ Partial Class Compact Me.sb_ResultsPanel.Controls.Add(Me.Label3) Me.sb_ResultsPanel.Controls.Add(Me.sb_compressedSizeVisual) Me.sb_ResultsPanel.Controls.Add(Me.Panel6) - Me.sb_ResultsPanel.Controls.Add(Me.sb_SpaceSavedLabel) Me.sb_ResultsPanel.Location = New System.Drawing.Point(3, 3) Me.sb_ResultsPanel.Name = "sb_ResultsPanel" Me.sb_ResultsPanel.Padding = New System.Windows.Forms.Padding(40, 0, 40, 0) @@ -499,18 +497,6 @@ Partial Class Compact Me.Panel6.Size = New System.Drawing.Size(40, 113) Me.Panel6.TabIndex = 0 ' - 'sb_SpaceSavedLabel - ' - Me.sb_SpaceSavedLabel.Font = New System.Drawing.Font("Segoe UI", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.sb_SpaceSavedLabel.ForeColor = System.Drawing.Color.White - Me.sb_SpaceSavedLabel.Location = New System.Drawing.Point(110, 91) - Me.sb_SpaceSavedLabel.Name = "sb_SpaceSavedLabel" - Me.sb_SpaceSavedLabel.Size = New System.Drawing.Size(113, 27) - Me.sb_SpaceSavedLabel.TabIndex = 27 - Me.sb_SpaceSavedLabel.Text = "700MB Saved" - Me.sb_SpaceSavedLabel.TextAlign = System.Drawing.ContentAlignment.BottomCenter - Me.sb_SpaceSavedLabel.Visible = False - ' 'sb_AnalysisPanel ' Me.sb_AnalysisPanel.Controls.Add(Me.sb_progresslabel) @@ -967,6 +953,13 @@ Partial Class Compact Me.CompResultsPanel.TabIndex = 31 Me.CompResultsPanel.Visible = False ' + 'results_arc + ' + Me.results_arc.Location = New System.Drawing.Point(13, 63) + Me.results_arc.Name = "results_arc" + Me.results_arc.Size = New System.Drawing.Size(265, 122) + Me.results_arc.TabIndex = 35 + ' 'labelFilesCompressed ' Me.labelFilesCompressed.AutoSize = True @@ -1169,13 +1162,6 @@ Partial Class Compact Me.Tray_ShowMain.Size = New System.Drawing.Size(78, 22) Me.Tray_ShowMain.Text = "Show" ' - 'results_arc - ' - Me.results_arc.Location = New System.Drawing.Point(13, 63) - Me.results_arc.Name = "results_arc" - Me.results_arc.Size = New System.Drawing.Size(265, 122) - Me.results_arc.TabIndex = 35 - ' 'Compact ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -1301,7 +1287,6 @@ Partial Class Compact Friend WithEvents Label3 As Label Friend WithEvents sb_compressedSizeVisual As Panel Friend WithEvents TableLayoutPanel2 As TableLayoutPanel - Friend WithEvents sb_SpaceSavedLabel As Label Friend WithEvents TableLayoutPanel4 As TableLayoutPanel Friend WithEvents updateBanner As Panel Friend WithEvents dlUpdateLink As LinkLabel diff --git a/CompactGUI/Compact.vb b/CompactGUI/Compact.vb index e0f7f3d..4b4a47c 100644 --- a/CompactGUI/Compact.vb +++ b/CompactGUI/Compact.vb @@ -502,7 +502,6 @@ Public Class Compact 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) diff --git a/Version.xml b/Version.xml index 5bf5b94..43f511e 100644 --- a/Version.xml +++ b/Version.xml @@ -4,6 +4,6 @@ False V2.6.0 2.6.0 - Reworked Wiki Parser to be compatible with new database. | Added check to avoid duplicate submissions of results + Reworked Wiki Parser to be compatible with new database. | Added check to avoid duplicate submissions of results | Tweaked layout of title and colour of update banner Removed redundant code From de203eeb8daacddf01b35ea2c3542a915281e946 Mon Sep 17 00:00:00 2001 From: ImminentFate Date: Sat, 3 Mar 2018 02:50:13 +1000 Subject: [PATCH 5/5] - Added list of files to be compressed to main page --- CompactGUI/Compact.Designer.vb | 110 +++++++++++++++++++++++---------- CompactGUI/Compact.resx | 9 ++- CompactGUI/Compact.vb | 34 +++++++++- CompactGUI/WikiHandler.vb | 1 - Version.xml | 4 +- 5 files changed, 117 insertions(+), 41 deletions(-) diff --git a/CompactGUI/Compact.Designer.vb b/CompactGUI/Compact.Designer.vb index 0ec2768..7aa3fec 100644 --- a/CompactGUI/Compact.Designer.vb +++ b/CompactGUI/Compact.Designer.vb @@ -42,7 +42,6 @@ Partial Class Compact Me.seecompest = New System.Windows.Forms.Label() Me.ToolTipFilesCompressed = New System.Windows.Forms.ToolTip(Me.components) Me.help_resultsFilesCompressed = New System.Windows.Forms.Label() - Me.Label14 = New System.Windows.Forms.Label() Me.sb_lblGameIssues = New System.Windows.Forms.Label() Me.panel_MainWindow = New System.Windows.Forms.Panel() Me.sb_Panel = New System.Windows.Forms.Panel() @@ -70,6 +69,9 @@ Partial Class Compact Me.vis_dropshadowMain = New System.Windows.Forms.Panel() Me.TabControl1 = New System.Windows.Forms.TabControl() Me.InputPage = New System.Windows.Forms.TabPage() + Me.Panel1 = New System.Windows.Forms.Panel() + Me.Label1 = New System.Windows.Forms.Label() + Me.SelectedFiles = New System.Windows.Forms.ListBox() Me.FlowPanel_CompressionOptions = New System.Windows.Forms.FlowLayoutPanel() Me.Panel4 = New System.Windows.Forms.Panel() Me.Label2 = New System.Windows.Forms.Label() @@ -87,7 +89,6 @@ Partial Class Compact Me.ProgressPage = New System.Windows.Forms.TabPage() Me.TableLayoutPanel4 = New System.Windows.Forms.TableLayoutPanel() Me.CompResultsPanel = New System.Windows.Forms.Panel() - Me.results_arc = New CompactGUI.GraphicsPanel() Me.labelFilesCompressed = New System.Windows.Forms.Label() Me.dirChosenLabel = New System.Windows.Forms.Label() Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() @@ -106,6 +107,7 @@ Partial Class Compact Me.TrayIcon = New System.Windows.Forms.NotifyIcon(Me.components) Me.TrayMenu = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.Tray_ShowMain = New System.Windows.Forms.ToolStripMenuItem() + Me.results_arc = New CompactGUI.GraphicsPanel() Me.panel_topBar.SuspendLayout() Me.updateBanner.SuspendLayout() Me.topbar_dirchooserContainer.SuspendLayout() @@ -118,6 +120,7 @@ Partial Class Compact Me.TableLayoutPanel3.SuspendLayout() Me.TabControl1.SuspendLayout() Me.InputPage.SuspendLayout() + Me.Panel1.SuspendLayout() Me.FlowPanel_CompressionOptions.SuspendLayout() Me.Panel4.SuspendLayout() Me.Panel3.SuspendLayout() @@ -362,19 +365,6 @@ Partial Class Compact Me.help_resultsFilesCompressed.Text = "(?)" Me.ToolTipFilesCompressed.SetToolTip(Me.help_resultsFilesCompressed, resources.GetString("help_resultsFilesCompressed.ToolTip")) ' - 'Label14 - ' - Me.Label14.AutoSize = True - Me.Label14.Font = New System.Drawing.Font("Segoe UI", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label14.ForeColor = System.Drawing.Color.FromArgb(CType(CType(52, Byte), Integer), CType(CType(152, Byte), Integer), CType(CType(219, Byte), Integer)) - Me.Label14.Location = New System.Drawing.Point(169, 66) - Me.Label14.Margin = New System.Windows.Forms.Padding(0, 1, 0, 0) - Me.Label14.Name = "Label14" - Me.Label14.Size = New System.Drawing.Size(22, 17) - Me.Label14.TabIndex = 32 - Me.Label14.Text = "(?)" - Me.ToolTipFilesCompressed.SetToolTip(Me.Label14, resources.GetString("Label14.ToolTip")) - ' 'sb_lblGameIssues ' Me.sb_lblGameIssues.Font = New System.Drawing.Font("Segoe UI", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) @@ -656,6 +646,7 @@ Partial Class Compact ' 'btnCompress ' + Me.btnCompress.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.btnCompress.BackColor = System.Drawing.Color.FromArgb(CType(CType(47, Byte), Integer), CType(CType(66, Byte), Integer), CType(CType(83, Byte), Integer)) Me.btnCompress.Enabled = False Me.btnCompress.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(CType(CType(102, Byte), Integer), CType(CType(121, Byte), Integer), CType(CType(138, Byte), Integer)) @@ -674,6 +665,7 @@ Partial Class Compact ' 'btnUncompress ' + Me.btnUncompress.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.btnUncompress.BackColor = System.Drawing.Color.FromArgb(CType(CType(47, Byte), Integer), CType(CType(66, Byte), Integer), CType(CType(83, Byte), Integer)) Me.btnUncompress.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(CType(CType(102, Byte), Integer), CType(CType(121, Byte), Integer), CType(CType(138, Byte), Integer)) Me.btnUncompress.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(CType(CType(72, Byte), Integer), CType(CType(112, Byte), Integer), CType(CType(138, Byte), Integer)) @@ -718,6 +710,7 @@ Partial Class Compact 'InputPage ' Me.InputPage.BackColor = System.Drawing.Color.White + Me.InputPage.Controls.Add(Me.Panel1) Me.InputPage.Controls.Add(Me.FlowPanel_CompressionOptions) Me.InputPage.Location = New System.Drawing.Point(4, 22) Me.InputPage.Name = "InputPage" @@ -726,6 +719,47 @@ Partial Class Compact Me.InputPage.TabIndex = 0 Me.InputPage.Text = "InputPage" ' + 'Panel1 + ' + Me.Panel1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.Panel1.Controls.Add(Me.Label1) + Me.Panel1.Controls.Add(Me.SelectedFiles) + Me.Panel1.Location = New System.Drawing.Point(44, 214) + Me.Panel1.Name = "Panel1" + Me.Panel1.Size = New System.Drawing.Size(574, 287) + Me.Panel1.TabIndex = 24 + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Font = New System.Drawing.Font("Segoe UI", 11.25!) + Me.Label1.ForeColor = System.Drawing.Color.FromArgb(CType(CType(48, Byte), Integer), CType(CType(67, Byte), Integer), CType(CType(84, Byte), Integer)) + Me.Label1.Location = New System.Drawing.Point(15, 35) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(99, 20) + Me.Label1.TabIndex = 18 + Me.Label1.Text = "Selected Files" + ' + 'SelectedFiles + ' + Me.SelectedFiles.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.SelectedFiles.BackColor = System.Drawing.Color.White + Me.SelectedFiles.BorderStyle = System.Windows.Forms.BorderStyle.None + Me.SelectedFiles.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable + Me.SelectedFiles.Font = New System.Drawing.Font("Segoe UI", 10.0!) + Me.SelectedFiles.ForeColor = System.Drawing.Color.FromArgb(CType(CType(48, Byte), Integer), CType(CType(67, Byte), Integer), CType(CType(84, Byte), Integer)) + Me.SelectedFiles.FormattingEnabled = True + Me.SelectedFiles.ItemHeight = 25 + Me.SelectedFiles.Location = New System.Drawing.Point(40, 59) + Me.SelectedFiles.Name = "SelectedFiles" + Me.SelectedFiles.Size = New System.Drawing.Size(534, 200) + Me.SelectedFiles.TabIndex = 23 + Me.SelectedFiles.TabStop = False + ' 'FlowPanel_CompressionOptions ' Me.FlowPanel_CompressionOptions.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ @@ -735,7 +769,7 @@ Partial Class Compact Me.FlowPanel_CompressionOptions.Controls.Add(Me.Panel3) Me.FlowPanel_CompressionOptions.Location = New System.Drawing.Point(44, 21) Me.FlowPanel_CompressionOptions.Name = "FlowPanel_CompressionOptions" - Me.FlowPanel_CompressionOptions.Size = New System.Drawing.Size(574, 216) + Me.FlowPanel_CompressionOptions.Size = New System.Drawing.Size(574, 174) Me.FlowPanel_CompressionOptions.TabIndex = 22 ' 'Panel4 @@ -747,7 +781,7 @@ Partial Class Compact Me.Panel4.Controls.Add(Me.compressX16) Me.Panel4.Location = New System.Drawing.Point(3, 3) Me.Panel4.Name = "Panel4" - Me.Panel4.Size = New System.Drawing.Size(266, 181) + Me.Panel4.Size = New System.Drawing.Size(266, 160) Me.Panel4.TabIndex = 24 ' 'Label2 @@ -768,9 +802,10 @@ Partial Class Compact Me.compressX4.ForeColor = System.Drawing.Color.FromArgb(CType(CType(48, Byte), Integer), CType(CType(67, Byte), Integer), CType(CType(84, Byte), Integer)) Me.compressX4.Location = New System.Drawing.Point(37, 38) Me.compressX4.Name = "compressX4" - Me.compressX4.Size = New System.Drawing.Size(74, 17) + Me.compressX4.Size = New System.Drawing.Size(77, 17) Me.compressX4.TabIndex = 9 - Me.compressX4.Text = "XPRESS4K" + Me.compressX4.Text = "XPRESS 4K" + Me.ToolTipFilesCompressed.SetToolTip(Me.compressX4, "Fastest, Low Compression") Me.compressX4.UseVisualStyleBackColor = True ' 'compressLZX @@ -783,6 +818,7 @@ Partial Class Compact Me.compressLZX.Size = New System.Drawing.Size(45, 17) Me.compressLZX.TabIndex = 12 Me.compressLZX.Text = "LZX " + Me.ToolTipFilesCompressed.SetToolTip(Me.compressLZX, "Slowest, Very High Compression (Not Recommended for Games/Programs)") Me.compressLZX.UseVisualStyleBackColor = True ' 'compressX8 @@ -793,10 +829,11 @@ Partial Class Compact Me.compressX8.ForeColor = System.Drawing.Color.FromArgb(CType(CType(48, Byte), Integer), CType(CType(67, Byte), Integer), CType(CType(84, Byte), Integer)) Me.compressX8.Location = New System.Drawing.Point(37, 68) Me.compressX8.Name = "compressX8" - Me.compressX8.Size = New System.Drawing.Size(74, 17) + Me.compressX8.Size = New System.Drawing.Size(77, 17) Me.compressX8.TabIndex = 10 Me.compressX8.TabStop = True - Me.compressX8.Text = "XPRESS8K" + Me.compressX8.Text = "XPRESS 8K" + Me.ToolTipFilesCompressed.SetToolTip(Me.compressX8, "Fast, Medium Compression (Recommended)") Me.compressX8.UseVisualStyleBackColor = True ' 'compressX16 @@ -806,9 +843,10 @@ Partial Class Compact Me.compressX16.ForeColor = System.Drawing.Color.FromArgb(CType(CType(48, Byte), Integer), CType(CType(67, Byte), Integer), CType(CType(84, Byte), Integer)) Me.compressX16.Location = New System.Drawing.Point(37, 98) Me.compressX16.Name = "compressX16" - Me.compressX16.Size = New System.Drawing.Size(80, 17) + Me.compressX16.Size = New System.Drawing.Size(83, 17) Me.compressX16.TabIndex = 11 - Me.compressX16.Text = "XPRESS16K" + Me.compressX16.Text = "XPRESS 16K" + Me.ToolTipFilesCompressed.SetToolTip(Me.compressX16, "Slow, High Compression") Me.compressX16.UseVisualStyleBackColor = True ' 'Panel3 @@ -817,13 +855,12 @@ Partial Class Compact Me.Panel3.Controls.Add(Me.checkShutdownOnCompletion) Me.Panel3.Controls.Add(Me.Label8) Me.Panel3.Controls.Add(Me.checkForceCompression) - Me.Panel3.Controls.Add(Me.Label14) Me.Panel3.Controls.Add(Me.checkHiddenFiles) Me.Panel3.Controls.Add(Me.checkRecursiveScan) Me.FlowPanel_CompressionOptions.SetFlowBreak(Me.Panel3, True) Me.Panel3.Location = New System.Drawing.Point(275, 3) Me.Panel3.Name = "Panel3" - Me.Panel3.Size = New System.Drawing.Size(290, 181) + Me.Panel3.Size = New System.Drawing.Size(290, 160) Me.Panel3.TabIndex = 23 ' 'comboChooseShutdown @@ -874,6 +911,7 @@ Partial Class Compact Me.checkForceCompression.Size = New System.Drawing.Size(133, 17) Me.checkForceCompression.TabIndex = 7 Me.checkForceCompression.Text = "Force Action on Files" + Me.ToolTipFilesCompressed.SetToolTip(Me.checkForceCompression, resources.GetString("checkForceCompression.ToolTip")) Me.checkForceCompression.UseVisualStyleBackColor = True ' 'checkHiddenFiles @@ -886,6 +924,7 @@ Partial Class Compact Me.checkHiddenFiles.Size = New System.Drawing.Size(192, 17) Me.checkHiddenFiles.TabIndex = 6 Me.checkHiddenFiles.Text = "Process Hidden and System Files" + Me.ToolTipFilesCompressed.SetToolTip(Me.checkHiddenFiles, resources.GetString("checkHiddenFiles.ToolTip")) Me.checkHiddenFiles.UseVisualStyleBackColor = True ' 'checkRecursiveScan @@ -901,6 +940,7 @@ Partial Class Compact Me.checkRecursiveScan.Size = New System.Drawing.Size(135, 17) Me.checkRecursiveScan.TabIndex = 5 Me.checkRecursiveScan.Text = "Compress Subfolders" + Me.ToolTipFilesCompressed.SetToolTip(Me.checkRecursiveScan, "This option is now checked by default and cannot be changed. ") Me.checkRecursiveScan.UseVisualStyleBackColor = True ' 'ProgressPage @@ -953,13 +993,6 @@ Partial Class Compact Me.CompResultsPanel.TabIndex = 31 Me.CompResultsPanel.Visible = False ' - 'results_arc - ' - Me.results_arc.Location = New System.Drawing.Point(13, 63) - Me.results_arc.Name = "results_arc" - Me.results_arc.Size = New System.Drawing.Size(265, 122) - Me.results_arc.TabIndex = 35 - ' 'labelFilesCompressed ' Me.labelFilesCompressed.AutoSize = True @@ -1162,6 +1195,13 @@ Partial Class Compact Me.Tray_ShowMain.Size = New System.Drawing.Size(78, 22) Me.Tray_ShowMain.Text = "Show" ' + 'results_arc + ' + Me.results_arc.Location = New System.Drawing.Point(13, 63) + Me.results_arc.Name = "results_arc" + Me.results_arc.Size = New System.Drawing.Size(265, 122) + Me.results_arc.TabIndex = 35 + ' 'Compact ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -1192,6 +1232,8 @@ Partial Class Compact Me.TableLayoutPanel3.ResumeLayout(False) Me.TabControl1.ResumeLayout(False) Me.InputPage.ResumeLayout(False) + Me.Panel1.ResumeLayout(False) + Me.Panel1.PerformLayout() Me.FlowPanel_CompressionOptions.ResumeLayout(False) Me.Panel4.ResumeLayout(False) Me.Panel4.PerformLayout() @@ -1255,7 +1297,6 @@ Partial Class Compact Friend WithEvents checkShutdownOnCompletion As CheckBox Friend WithEvents Label8 As Label Friend WithEvents checkForceCompression As CheckBox - Friend WithEvents Label14 As Label Friend WithEvents checkHiddenFiles As CheckBox Friend WithEvents checkRecursiveScan As CheckBox Friend WithEvents btnCompress As Button @@ -1294,4 +1335,7 @@ Partial Class Compact Friend WithEvents TrayIcon As NotifyIcon Friend WithEvents TrayMenu As ContextMenuStrip Friend WithEvents Tray_ShowMain As ToolStripMenuItem + Friend WithEvents SelectedFiles As ListBox + Friend WithEvents Label1 As Label + Friend WithEvents Panel1 As Panel End Class diff --git a/CompactGUI/Compact.resx b/CompactGUI/Compact.resx index 45aad7e..56e6538 100644 --- a/CompactGUI/Compact.resx +++ b/CompactGUI/Compact.resx @@ -138,15 +138,18 @@ If the number of compressed files appears too small: • Try running CompactGUI as an Administrator - + 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. + • Press "Analyse Folder" then decompress all the files in the folder, fixing the interrupted file in the process. + + + 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. 644, 17 diff --git a/CompactGUI/Compact.vb b/CompactGUI/Compact.vb index 4b4a47c..8a9ea30 100644 --- a/CompactGUI/Compact.vb +++ b/CompactGUI/Compact.vb @@ -120,7 +120,7 @@ Public Class Compact ListOfFiles.Clear() AllFiles.Clear() TreeData.Clear() - + SelectedFiles.Items.Clear() directorysizeexceptionCount = 0 If DI_selectedDir.Name.Length > 0 Then _ @@ -140,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) @@ -165,7 +174,7 @@ 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) @@ -173,10 +182,13 @@ Public Class Compact 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) @@ -882,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 diff --git a/CompactGUI/WikiHandler.vb b/CompactGUI/WikiHandler.vb index 8136013..00f4605 100644 --- a/CompactGUI/WikiHandler.vb +++ b/CompactGUI/WikiHandler.vb @@ -221,7 +221,6 @@ Class WikiHandler workingname = wnpatch - folderSize = Math.Round(Decimal.Parse(rawPreSize.Split(" ")(0)), 2) suffix = rawPreSize.Split(" ")(1) diff --git a/Version.xml b/Version.xml index 43f511e..7ff1189 100644 --- a/Version.xml +++ b/Version.xml @@ -4,6 +4,6 @@ False V2.6.0 2.6.0 - Reworked Wiki Parser to be compatible with new database. | Added check to avoid duplicate submissions of results | Tweaked layout of title and colour of update banner - Removed redundant code + Reworked Wiki Parser to be compatible with new database. | Added check to avoid duplicate submissions of results | Added list of files to be compressed to the main page | Tweaked layout of title and colour of update banner + Removed redundant code and controls