Skip to content

Commit

Permalink
Added option to just generate a batch script file.
Browse files Browse the repository at this point in the history
  • Loading branch information
moisespr123 committed Dec 5, 2019
1 parent b3c9567 commit c6e65d2
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 11 deletions.
17 changes: 15 additions & 2 deletions PAQCompress/Form1.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 24 additions & 7 deletions PAQCompress/Form1.vb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
s_flag.Checked = My.Settings.s_flag
f_flag.Checked = My.Settings.f_flag
ShowCMD.Checked = My.Settings.ShowCMD
GenerateBatchScriptOnly.Checked = My.Settings.OnlyGenerateBatchFile
EnableDisableFlags()
Dim vars As String() = Environment.GetCommandLineArgs
If vars.Count > 1 Then
Expand Down Expand Up @@ -324,14 +325,25 @@
CompressorToUse = IO.Path.GetDirectoryName(Process.GetCurrentProcess.MainModule.FileName) + "/" + CompressorToUse
Dim CompressorPath As String = IO.Path.GetDirectoryName(CompressorToUse)
If IO.File.Exists(CompressorToUse) Then
StartButton.Enabled = False
SaveLogButton.Enabled = False
If ShowCMD.Checked Then
CompressionParameters = "/C " + CompressorToUse + " " + CompressionParameters + " & pause"
CompressorToUse = "cmd.exe"
If Not GenerateBatchScriptOnly.Checked Then
StartButton.Enabled = False
SaveLogButton.Enabled = False
If ShowCMD.Checked Then
CompressionParameters = "/C " + CompressorToUse + " " + CompressionParameters + " & pause"
CompressorToUse = "cmd.exe"
End If
Dim StartCompressionThread = New Threading.Thread(Sub() CompressionThread(CompressorToUse, CompressionParameters, CompressorPath))
StartCompressionThread.Start()
Else
Dim OutputPath As String
If IO.Directory.Exists(OutputLocation.Text) Then
OutputPath = OutputLocation.Text + "\" + IO.Path.GetFileName(OutputLocation.Text) + ".bat"
Else
OutputPath = IO.Path.ChangeExtension(OutputLocation.Text, ".bat")
End If
IO.File.WriteAllText(OutputPath, CompressorToUse + " " + CompressionParameters + " & pause")
MsgBox("Batch file written to the output location.")
End If
Dim StartCompressionThread = New Threading.Thread(Sub() CompressionThread(CompressorToUse, CompressionParameters, CompressorPath))
StartCompressionThread.Start()
Else
MsgBox("The selected compressor version could not be found. Cannot proceed")
End If
Expand Down Expand Up @@ -521,4 +533,9 @@
My.Settings.ShowCMD = ShowCMD.Checked
My.Settings.Save()
End Sub

Private Sub GenerateBatchScriptOnly_CheckedChanged(sender As Object, e As EventArgs) Handles GenerateBatchScriptOnly.CheckedChanged
My.Settings.OnlyGenerateBatchFile = GenerateBatchScriptOnly.Checked
My.Settings.Save()
End Sub
End Class
4 changes: 2 additions & 2 deletions PAQCompress/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("0.3.27.0")>
<Assembly: AssemblyFileVersion("0.3.27.0")>
<Assembly: AssemblyVersion("0.3.28.0")>
<Assembly: AssemblyFileVersion("0.3.28.0")>
12 changes: 12 additions & 0 deletions PAQCompress/My Project/Settings.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions PAQCompress/My Project/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@
<Setting Name="ShowCMD" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="OnlyGenerateBatchFile" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>
3 changes: 3 additions & 0 deletions PAQCompress/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
<setting name="ShowCMD" serializeAs="String">
<value>False</value>
</setting>
<setting name="OnlyGenerateBatchFile" serializeAs="String">
<value>False</value>
</setting>
</PAQCompress.My.MySettings>
</userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>

0 comments on commit c6e65d2

Please sign in to comment.