looking for a media patcher source

09/23/2011 11:30 sercankd#1
yes i know i ask too many things but i am just curious about those stuff :D trying to improve myself with a project. i am just stuck at editing ip in media.pk2
i am using this code but it gives error when i start, checked it with hex editor it does the job but silkroad.exe gives some errors like Memory#$|d£#Æ
Code:
        Dim fs As New FileStream("D:\Bloody Silkroad\Media.pk2", FileMode.Open, FileAccess.Write)
        Dim br As New BinaryWriter(fs)
        Dim bytes() As Byte
        'IP1
        br.BaseStream.Position = "&H1E9A0059"
        bytes = System.Text.Encoding.Default.GetBytes(ip1.Text)
        br.Write(bytes)
        If ip1.TextLength <> 16 Then
            For i = 1 To 16 - ip1.TextLength
                Dim tmp As Byte = &H0
                br.Write(tmp)
            Next
        End If
        br.Close()
        fs.Close()
i found this code somewhere in this forum end edited for myself,hex location is true i have checked it.
but i have decompiled some media patchers and they are using some class called LoadPk2File, and i guess there is bunch of functions to do my job, searched on google and i havent found it yet.they are just editing divisioninfo.txt instead of hex edits.

example


Code:
loc_431AB6:   var_88 = PropBag.ReadProperty(Me.txtMedia.Text, "\divisioninfo.txt")
loc_431AF9:   var_8C = PropBag.ReadProperty(Me.txtMedia.Text, "\gateport.txt")
loc_431B0C:   lPort = var_8C
loc_431B1B:   lIP1 = (var_88 + &H11)
loc_431B30:   lIP2 = ((var_88 + &H11) + &H15)
loc_432716:   Call SaveDataInPk2(Me.txtMedia.Text, lPort)
loc_432743:   Call SaveDataInPk2(Me.txtMedia.Text, lIP1)
loc_432770:   Call SaveDataInPk2(Me.txtMedia.Text, lIP2)