From 6bf3f0dd66e5500143fba0787e4516db87453893 Mon Sep 17 00:00:00 2001 From: ImminentFate Date: Mon, 16 Oct 2017 19:33:21 +1000 Subject: [PATCH 1/2] Fixed output window being too narrow while analysing Switched to PS for output control. --- WindowsApp1/Compact.Designer.vb | 32 +++++++++++++------------------- WindowsApp1/Compact.vb | 14 +++++++------- 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/WindowsApp1/Compact.Designer.vb b/WindowsApp1/Compact.Designer.vb index a4b75fb..3de19f4 100644 --- a/WindowsApp1/Compact.Designer.vb +++ b/WindowsApp1/Compact.Designer.vb @@ -73,6 +73,7 @@ Partial Class Compact Me.ProgressPage = New System.Windows.Forms.TabPage() Me.FlowLayoutPanel2 = New System.Windows.Forms.FlowLayoutPanel() Me.CompResultsPanel = New System.Windows.Forms.Panel() + Me.dirChosenLabel = New System.Windows.Forms.Label() Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() Me.Label13 = New System.Windows.Forms.Label() Me.labelFilesCompressed = New System.Windows.Forms.Label() @@ -84,7 +85,6 @@ Partial Class Compact Me.TabPage3 = New System.Windows.Forms.TabPage() Me.testFileArgs = New System.Windows.Forms.Button() Me.ToolTipFilesCompressed = New System.Windows.Forms.ToolTip(Me.components) - Me.dirChosenLabel = New System.Windows.Forms.Label() Me.Panel1.SuspendLayout() Me.TabControl1.SuspendLayout() Me.InputPage.SuspendLayout() @@ -102,16 +102,13 @@ Partial Class Compact ' 'conOut ' - Me.conOut.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.conOut.BackColor = System.Drawing.Color.White Me.conOut.BorderStyle = System.Windows.Forms.BorderStyle.None Me.conOut.ForeColor = System.Drawing.Color.DimGray Me.conOut.Location = New System.Drawing.Point(3, 313) Me.conOut.Name = "conOut" Me.conOut.ReadOnly = True - Me.conOut.Size = New System.Drawing.Size(402, 161) + Me.conOut.Size = New System.Drawing.Size(375, 161) Me.conOut.TabIndex = 0 Me.conOut.Text = "" Me.conOut.Visible = False @@ -631,9 +628,6 @@ Partial Class Compact ' 'FlowLayoutPanel2 ' - Me.FlowLayoutPanel2.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.FlowLayoutPanel2.Controls.Add(Me.buttonRevert) Me.FlowLayoutPanel2.Controls.Add(Me.CompResultsPanel) Me.FlowLayoutPanel2.Controls.Add(Me.checkShowConOut) @@ -660,6 +654,17 @@ Partial Class Compact Me.CompResultsPanel.TabIndex = 31 Me.CompResultsPanel.Visible = False ' + 'dirChosenLabel + ' + Me.dirChosenLabel.AutoSize = True + Me.dirChosenLabel.Font = New System.Drawing.Font("Segoe UI", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.dirChosenLabel.ForeColor = System.Drawing.Color.DarkGray + Me.dirChosenLabel.Location = New System.Drawing.Point(2, 79) + Me.dirChosenLabel.Name = "dirChosenLabel" + Me.dirChosenLabel.Size = New System.Drawing.Size(87, 15) + Me.dirChosenLabel.TabIndex = 32 + Me.dirChosenLabel.Text = "dirchosenLabel" + ' 'TableLayoutPanel1 ' Me.TableLayoutPanel1.AutoSize = True @@ -794,17 +799,6 @@ Partial Class Compact Me.ToolTipFilesCompressed.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info Me.ToolTipFilesCompressed.ToolTipTitle = "Number of Files Compressed" ' - 'dirChosenLabel - ' - Me.dirChosenLabel.AutoSize = True - Me.dirChosenLabel.Font = New System.Drawing.Font("Segoe UI", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.dirChosenLabel.ForeColor = System.Drawing.Color.DarkGray - Me.dirChosenLabel.Location = New System.Drawing.Point(2, 79) - Me.dirChosenLabel.Name = "dirChosenLabel" - Me.dirChosenLabel.Size = New System.Drawing.Size(87, 15) - Me.dirChosenLabel.TabIndex = 32 - Me.dirChosenLabel.Text = "dirchosenLabel" - ' 'Compact ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) diff --git a/WindowsApp1/Compact.vb b/WindowsApp1/Compact.vb index b3070f3..0a75e78 100644 --- a/WindowsApp1/Compact.vb +++ b/WindowsApp1/Compact.vb @@ -32,7 +32,7 @@ Public Class Compact Dim fileCountProgress As Int64 Dim fileCountOutputCompressed As Int64 Dim QdirCountProgress As Int64 - + Dim localisationAdjustment = "[Threading.Thread]::CurrentThread.CurrentUICulture = 'en'; " Private Sub MyProcess_ErrorDataReceived _ (ByVal sender As Object, ByVal e As System.Diagnostics.DataReceivedEventArgs) _ @@ -53,7 +53,7 @@ Public Class Compact Try - If e.Data.Contains("total bytes of data are stored in") Then 'Gets the output line that contains both the pre- and post-compression folder sizes + If e.Data.Contains("total bytes of data are stored in") Then 'Gets the output line that contains both the pre- and post-compression folder sizes byteComparisonRaw = e.Data End If @@ -344,7 +344,7 @@ Public Class Compact MyProcess = New Process With MyProcess.StartInfo - .FileName = "CMD.exe" + .FileName = "powershell.exe" .Arguments = "" .UseShellExecute = False .CreateNoWindow = True @@ -361,7 +361,7 @@ Public Class Compact Try - MyProcess.StandardInput.WriteLine("cd /d " + workingDir) + MyProcess.StandardInput.WriteLine("cd " + workingDir) MyProcess.StandardInput.Flush() MyProcess.StandardInput.WriteLine("") 'Required for the embedded console to show the next line in the buffer after the 'cd' command. No idea why @@ -599,7 +599,7 @@ Public Class Compact compactArgs = compactArgs + " /EXE:LZX" End If - MyProcess.StandardInput.WriteLine(compactArgs) + MyProcess.StandardInput.WriteLine(localisationAdjustment & compactArgs) MyProcess.StandardInput.Flush() isQueryCalledByCompact = 1 @@ -616,13 +616,13 @@ Public Class Compact compactArgs = compactArgs + " /A" End If - MyProcess.StandardInput.WriteLine(compactArgs) + MyProcess.StandardInput.WriteLine(localisationAdjustment & compactArgs) MyProcess.StandardInput.Flush() ElseIf desiredfunction = "query" Then compactArgs = "compact /S /Q /EXE" - MyProcess.StandardInput.WriteLine(compactArgs) + MyProcess.StandardInput.WriteLine(localisationAdjustment & compactArgs) MyProcess.StandardInput.Flush() End If From 73f702cec748199d6f64a0b641260874443b988b Mon Sep 17 00:00:00 2001 From: ImminentFate Date: Mon, 16 Oct 2017 20:26:03 +1000 Subject: [PATCH 2/2] Switched back to using CMD and (I think) it should no longer be broken for non-English users --- WindowsApp1/Compact.vb | 14 ++++++++------ WindowsApp1/My Project/AssemblyInfo.vb | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/WindowsApp1/Compact.vb b/WindowsApp1/Compact.vb index 0a75e78..6a5352b 100644 --- a/WindowsApp1/Compact.vb +++ b/WindowsApp1/Compact.vb @@ -5,7 +5,7 @@ Imports System.Text.RegularExpressions Imports Ookii.Dialogs 'Uses Ookii Dialogs for the non-archaic filebrowser dialog. http://www.ookii.org/Software/Dialogs Public Class Compact - Dim version = "1.3.4" + Dim version = "1.3.5" Private WithEvents MyProcess As Process Private Delegate Sub AppendOutputTextDelegate(ByVal text As String) @@ -32,7 +32,7 @@ Public Class Compact Dim fileCountProgress As Int64 Dim fileCountOutputCompressed As Int64 Dim QdirCountProgress As Int64 - Dim localisationAdjustment = "[Threading.Thread]::CurrentThread.CurrentUICulture = 'en'; " + Private Sub MyProcess_ErrorDataReceived _ (ByVal sender As Object, ByVal e As System.Diagnostics.DataReceivedEventArgs) _ @@ -344,7 +344,7 @@ Public Class Compact MyProcess = New Process With MyProcess.StartInfo - .FileName = "powershell.exe" + .FileName = "CMD.exe" .Arguments = "" .UseShellExecute = False .CreateNoWindow = True @@ -367,6 +367,8 @@ Public Class Compact MyProcess.StandardInput.WriteLine("") 'Required for the embedded console to show the next line in the buffer after the 'cd' command. No idea why MyProcess.StandardInput.Flush() + MyProcess.StandardInput.WriteLine("chcp 437") + MyProcess.StandardInput.Flush() RunCompact(passthrougharg) @@ -599,7 +601,7 @@ Public Class Compact compactArgs = compactArgs + " /EXE:LZX" End If - MyProcess.StandardInput.WriteLine(localisationAdjustment & compactArgs) + MyProcess.StandardInput.WriteLine(compactArgs) MyProcess.StandardInput.Flush() isQueryCalledByCompact = 1 @@ -616,13 +618,13 @@ Public Class Compact compactArgs = compactArgs + " /A" End If - MyProcess.StandardInput.WriteLine(localisationAdjustment & compactArgs) + MyProcess.StandardInput.WriteLine(compactArgs) MyProcess.StandardInput.Flush() ElseIf desiredfunction = "query" Then compactArgs = "compact /S /Q /EXE" - MyProcess.StandardInput.WriteLine(localisationAdjustment & compactArgs) + MyProcess.StandardInput.WriteLine(compactArgs) MyProcess.StandardInput.Flush() End If diff --git a/WindowsApp1/My Project/AssemblyInfo.vb b/WindowsApp1/My Project/AssemblyInfo.vb index 9e38227..5ddde44 100644 --- a/WindowsApp1/My Project/AssemblyInfo.vb +++ b/WindowsApp1/My Project/AssemblyInfo.vb @@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices ' by using the '*' as shown below: ' - - + +