这是&#34的游戏保存编辑器;只是因为2"用Visual Basic制作
Imports PackageIO
Public Class Form1
Dim Money As String
Dim Filepath As String
Dim Chaos As String
Dim weppart As String
Dim vpart As String
Private Sub Open_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim open As New OpenFileDialog
open.Title = "Open JS2 GameSave"
open.ShowDialog()
Filepath = open.FileName
ReadFile()
End Sub
Private Sub ReadFile()
Try
Dim Reader As New PackageIO.Reader(Filepath, PackageIO.Endian.Big)
Reader.Position = 236068
Money = Reader.Position
TextBox1.Text = Reader.ReadInt32
Catch ex As Exception
MsgBox(ErrorToString)
End Try
End Sub
Private Sub ReadFile2()
Try
Dim Reader As New PackageIO.Reader(Filepath, PackageIO.Endian.Big)
Reader.Position = 8
Chaos = Reader.Position
TextBox2.Text = Reader.ReadInt32
Catch ex As Exception
MsgBox(ErrorToString)
End Try
End Sub
Private Sub ReadFile3()
Try
Dim Reader As New PackageIO.Reader(Filepath, PackageIO.Endian.Big)
Reader.Position = 236038
weppart = Reader.Position
TextBox3.Text = Reader.ReadInt32
Catch ex As Exception
MsgBox(ErrorToString)
End Try
End Sub
Private Sub ReadFile4()
Try
Dim Reader As New PackageIO.Reader(Filepath, PackageIO.Endian.Big)
Reader.Position = 236058
vpart = Reader.Position
TextBox4.Text = Reader.ReadInt32
Catch ex As Exception
MsgBox(ErrorToString)
End Try
End Sub
Private Sub WriteFile()
Try
Dim Writer As New PackageIO.Writer(Filepath, PackageIO.Endian.Big)
Writer.Position = Money
Writer.WriteInt32(TextBox1.Text)
MsgBox("Modded Succesfully")
Catch ex As Exception
MsgBox(ErrorToString)
End Try
End Sub
Private Sub WriteFile2()
Try
Dim Writer As New PackageIO.Writer(Filepath, PackageIO.Endian.Big)
Writer.Position = Chaos
Writer.WriteInt32(TextBox2.Text)
MsgBox("Modded Succesfully")
Catch ex As Exception
MsgBox(ErrorToString)
End Try
End Sub
Private Sub WriteFile3()
Try
Dim Writer As New PackageIO.Writer(Filepath, PackageIO.Endian.Big)
Writer.Position = weppart
Writer.WriteInt32(TextBox3.Text)
MsgBox("Modded Succesfully")
Catch ex As Exception
MsgBox(ErrorToString)
End Try
End Sub
Private Sub WriteFile4()
Try
Dim Writer As New PackageIO.Writer(Filepath, PackageIO.Endian.Big)
Writer.Position = vpart
Writer.WriteInt32(TextBox4.Text)
MsgBox("Modded Succesfully")
Catch ex As Exception
MsgBox(ErrorToString)
End Try
End Sub
Private Sub WriteFiles()
WriteFile()
WriteFile2()
WriteFile3()
WriteFile4()
End Sub
Private Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WriteFiles()
End Sub
End Class
基本上,当我点击保存时,它会打开4个保存窗口。我只希望它弹出一次。这是一个游戏保存编辑器,用于"只是因为2"用Visual Basic制作
答案 0 :(得分:0)
“它打开4保存窗口”意味着什么?你的意思是你看到4次打开文件对话框?或者你的意思是你看到消息“Modded Succesfully”四次?如果是后者,那是因为你在每个WriteFileN
方法中调用它4次。只需从每个写入方法中删除MsgBox
调用,并在调用所有写入方法后添加一次:
Private Sub WriteFiles()
WriteFile()
WriteFile2()
WriteFile3()
WriteFile4()
MsgBox("Modded Succesfully") '<--- Only place where this should be
End Sub