Hey, so.. I've made a gamesave editor.. It works quite well... except when it comes to saving/writing the file. It worked at one time, but I recently remodeled it and it... died. Could anyone help me figure out what I'm doing wrong? Here's the code I've used in the past (no longer working): Private Sub SaveChangesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveChangesToolStripMenuItem.Click Try Dim Writer As New PackageIO.Writer(FilePath, PackageIO.Endian.Big) MsgBox("Your changes have been applied!") Catch ex As Exception MsgBox(ErrorToString) End Try End Sub
Code: Private Sub SaveChangesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveChangesToolStripMenuItem.Click Try //Sets up Writer Dim Writer As New PackageIO.Writer(FilePath, PackageIO.Endian.Big) //You need to actually write something, there are a lot of //different options if you type Write. Writer.WriteInt32(999999999) //Always close the Reader or Writer Writer.Close() MsgBox("Your changes have been applied!") Catch ex As Exception MsgBox(ex.ShowMessage) End Try End Sub
I do have it set up to write stuff, it's just... Here, I'll post a shorter version of it. Public Class Offline Dim StoryTime As String Dim FilePath As String Private Sub Readfile() Try Dim Reader As New PackageIO.Reader(FilePath, PackageIO.Endian.Big) Reader.Position = 54624 StoryTime = Reader.Position NumericUpDown1.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 = StoryTime Writer.WriteInt32(NumericUpDown1.Text) MsgBox("Your changes have been applied!") Catch ex As Exception MsgBox(ErrorToString) End Try End Sub Private Sub LoadGamesaveToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadGamesaveToolStripMenuItem.Click Dim Open As New OpenFileDialog Open.Title = "Open Soulcalibur V Gamesave!" Open.ShowDialog() FilePath = Open.FileName Readfile() End Sub Private Sub SaveChangesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveChangesToolStripMenuItem.Click Try Dim Writer As New PackageIO.Writer(FilePath, PackageIO.Endian.Big) MsgBox("Your changes have been applied!") Catch ex As Exception MsgBox(ErrorToString) End Try End Sub End Class There's quite a few more than the "StoryTime", but.. yeah. I had this setup before the remodel and it worked fine, but it's not now.
Oh.. I think the reader not being closed prevented it from writing.. Once i added that in, it worked just fine. Now.. If only I can figure out how to save it as a new file in a new folder as opposed to overwriting the original...