0
我在順序運行的事件中遇到了問題。我有一個初始腳本來反編譯swf。第二個在反編譯的文件中搜索一個字符串,第三個用於重新編譯爲新的swf。重疊批處理文件運行問題
如何讓每個進程等到下一個啓動前完成?
我也遇到了使第二個腳本實際工作的問題。如果我能夠在完成後展示它所替代的內容,那將會很好。
這裏是我的腳本至今:
Imports System.Net
Public Class Form3
Private Sub Button7_Click(sender As System.Object, e As System.EventArgs) Handles Button7.Click
If TextBox4.Text = "" Then
MessageBox.Show("Please select a directory")
Else
Dim fd As OpenFileDialog = New Ope
nFileDialog()
Dim strFileName As String
fd.Title = "Open File Dialog"
fd.InitialDirectory = TextBox1.Text
fd.Filter = "All files (*.*)|*.*|All files (*.*)|*.*"
fd.FilterIndex = 2
fd.RestoreDirectory = True
If fd.ShowDialog() = DialogResult.OK Then
strFileName = fd.FileName
If InStr(strFileName, ".swf") <> 0 Then
TextBox2.Text = strFileName
Else
MessageBox.Show("You have to pick a .swf silly...")
End If
End If
End If
End Sub
Private Sub Button8_Click(sender As System.Object, e As System.EventArgs) Handles Button8.Click
Me.Close()
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim Folder = TextBox4.Text & "\HEXED"
If TextBox2.Text = "" Then
MessageBox.Show("You have to pick a .swf silly...")
Else
If My.Computer.FileSystem.DirectoryExists(Folder) Then
My.Computer.FileSystem.DeleteDirectory(Folder, FileIO.DeleteDirectoryOption.DeleteAllContents)
End If
My.Computer.FileSystem.CopyDirectory("C:\Users\Matt\Documents\My_Games\ROTMG\ShadyGamer\WindowsApplication1\WindowsApplication1\RABCDasm", Folder)
My.Computer.FileSystem.CopyFile(TextBox2.Text, Folder & "\client.swf", True)
Dim FILE_NAME As String = Folder & "\decompile.bat"
Dim i As Integer
Dim aryText(4) As String
aryText(0) = "cd " & Folder
aryText(1) = "swfdecompress client.swf"
aryText(2) = "abcexport client.swf"
aryText(3) = "rabcdasm client-1.abc"
Dim objWriter As New System.IO.StreamWriter(FILE_NAME, False)
For i = 0 To 3
objWriter.WriteLine(aryText(i))
Next
objWriter.Close()
Dim psi As New ProcessStartInfo(Folder & "\decompile.bat")
psi.RedirectStandardError = True
psi.RedirectStandardOutput = True
psi.CreateNoWindow = False
psi.WindowStyle = ProcessWindowStyle.Hidden
psi.UseShellExecute = False
Dim decompile As New Process
Process.Start(psi)
MessageBox.Show("Click Step 2")
Button1.Visible = False
Button3.Visible = True
End If
End Sub
Private Sub TextBox4_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox4.TextChanged
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
Dim MyFolderBrowser As New System.Windows.Forms.FolderBrowserDialog
MyFolderBrowser.Description = "Select the Folder"
MyFolderBrowser.ShowNewFolderButton = False
Dim dlgResult As DialogResult = MyFolderBrowser.ShowDialog()
If dlgResult = Windows.Forms.DialogResult.OK Then
TextBox4.Text = MyFolderBrowser.SelectedPath
End If
End Sub
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
Dim Folder = TextBox4.Text & "\HEXED"
Const quote As String = """"
Dim MyFile As String = Folder & "\client-1\com\company\assembleegameclient\parameters\Parameters.class.asasm"
Replace(MyFile, quote & TextBox1.Text & quote, quote & TextBox3.Text & quote)
MessageBox.Show("Click Step 3")
Button3.Visible = False
Button4.Visible = True
End Sub
Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click
Dim Folder = TextBox4.Text & "\HEXED"
Dim FILE_NAME2 As String = Folder & "\recompile.bat"
Dim j As Integer
Dim aryText2(4) As String
aryText2(0) = "cd " & Folder
aryText2(1) = "rabcasm client-1\client-1.main.asasm"
aryText2(2) = "abcreplace client.swf 1 client-1\client-1.main.abc"
Dim objWriter2 As New System.IO.StreamWriter(FILE_NAME2, False)
For j = 0 To 2
objWriter2.WriteLine(aryText2(j))
Next
objWriter2.Close()
Dim ps As New ProcessStartInfo(Folder & "\recompile.bat")
ps.RedirectStandardError = True
ps.RedirectStandardOutput = True
ps.CreateNoWindow = False
ps.WindowStyle = ProcessWindowStyle.Hidden
ps.UseShellExecute = False
Dim recompile As Process = Process.Start(ps)
My.Computer.FileSystem.CopyFile(Folder & "\client.swf", TextBox4.Text & "\hexed.swf", True)
End Sub
End Class
我之前試過這個,它說我必須引用一個對象。所以然後我嘗試:decompile.WaitForExit(),它似乎並沒有工作 – Matt
@matt看到更新的答案 – GJKH
感謝您的答覆,我會試試這個! – Matt