Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Main
- Private Sub BtnFile_Click(sender As Object, e As EventArgs) Handles BtnFile.Click
- Dim Open As New OpenFileDialog
- With Open
- .Filter = "All Files|*.*"
- .InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
- .Title = "Choose File"
- If (.ShowDialog) = Windows.Forms.DialogResult.OK Then
- TBPath.Text = .FileName
- Count = Nothing
- BtnCompress.Enabled = True
- Else
- Exit Sub
- End If
- End With
- End Sub
- Dim Count As Integer = Nothing
- Private Sub BtnCompress_Click(sender As Object, e As EventArgs) Handles BtnCompress.Click
- If Count = 1 Then
- MessageBox.Show("Maaf Mengompress Tidak Bisa Sampai 2 Kali", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- Else
- Try
- Count += 1
- Dim Path As String = TBPetik.Text & TBPath.Text & TBPetik.Text
- Dim pres As String = My.Computer.FileSystem.SpecialDirectories.Temp
- Dim presnam As String = pres & "\mpress.exe"
- Dim Jalan As String = pres & "\Compress.bat"
- Dim BackUPS As String = pres & "\BackUp.bat"
- Dim CleanAll As String = pres & "\Clean.bat"
- IO.File.WriteAllText(CleanAll, "RD /S /Q %temp%")
- IO.File.WriteAllBytes(presnam, My.Resources.mpress)
- Dim CleanProses As Process
- CleanProses = New Process()
- Dim BackUpProses As Process
- BackUpProses = New Process()
- Dim PressProses As Process
- PressProses = New Process()
- If RBNetProject.Checked = True Then
- IO.File.WriteAllText(Jalan, "cd %temp%" & vbNewLine & "mpress -s " & Path & " -i")
- If CBBackup.Checked = True Then
- IO.File.WriteAllText(BackUPS, "cd %temp%" & vbNewLine & "mpress -b " & Path & " -i")
- BackUpProses.StartInfo.FileName = BackUPS
- BackUpProses.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
- BackUpProses.Start()
- BackUpProses.WaitForExit()
- End If
- PressProses.StartInfo.FileName = Jalan
- PressProses.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
- PressProses.Start()
- PressProses.WaitForExit()
- CleanProses.StartInfo.FileName = CleanAll
- CleanProses.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
- CleanProses.Start()
- CleanProses.WaitForExit()
- ElseIf RBOther.Checked = True Then
- IO.File.WriteAllText(Jalan, "cd %temp%" & vbNewLine & "mpress -i " & Path)
- If CBBackup.Checked = True Then
- IO.File.WriteAllText(BackUPS, "cd %temp%" & vbNewLine & "mpress -b " & Path & " -i")
- BackUpProses.StartInfo.FileName = BackUPS
- BackUpProses.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
- BackUpProses.Start()
- BackUpProses.WaitForExit()
- End If
- PressProses.StartInfo.FileName = Jalan
- PressProses.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
- PressProses.Start()
- PressProses.WaitForExit()
- CleanProses.StartInfo.FileName = CleanAll
- CleanProses.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
- CleanProses.Start()
- CleanProses.WaitForExit()
- End If
- MessageBox.Show("Done", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
- Catch ex As Exception
- MessageBox.Show("Error!!!" & vbNewLine & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- End Try
- End If
- End Sub
- Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement