Im using this code in vb.net, but works only one byte replacing. Plz, how to work many byte search and replace....


I want find all F1 B6 D9 E8 C5 and replace to F7 B3 D1 E7 C4 and save...


my code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim fullFilename As String
        'Select file ...
        Using ofd As New OpenFileDialog
            ofd.Title = "Select Alauch file..."
            ofd.Filter = "Alaunch File (Alaunch.r**)|Alaunch.r**"
            If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
                fullFilename = ofd.FileName
            Else
                Exit Sub
            End If
        End Using
        Dim mmmfile As String = IO.Path.GetFileName(fullFilename)

        If ComboBox1.SelectedItem = "BigIcons" Then
            TextBox1.Clear()

            Dim Int0 As String = &HF1B6D9E8C5&
            Dim Int1 As String = &HF7B3D1E7C4&
            Dim bytes() As Byte = IO.File.ReadAllBytes(mmmfile)
            For i As Integer = 0 To bytes.Length - 5
                If bytes(i) = Int0 Then
                    bytes(i) = Int1
                End If
            Next

            IO.File.WriteAllBytes("d:\" + mmmfile, bytes)


            TextBox1.Text = "Status: Modding completed!"
        End If
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.