Hello,

I want to make an application that can change the arrays of bytes, I want something that could look like this:

    If Button1.Enabled then
    arrayofbyte1("2g 7a 13") changes to ("a3 f7 11")
    Else
    arrayofbyte1("a3 f7 11") changes to ("2g 7a 13")

I hope you understand what I want to say, I don't speak very well English...

Please, help me, I really need it, I want to release it soon as possible.... :)

are the values gonna be constant like in your example?

you pretty much have the code down. id probly use an IIf but your way would work to.

save the values in constant variables if they are the two values that you are always gonna switch between.

You could use a third array as a temproary holding space.

temparray = array1
array1 = array2
array2 = temparray

this will swap the arrays. To swap the other way change around array1 and array2

I suggest you create a map. That could be a dictionary where the key is the original byte and the value is the byte you want to replace it with. Then you can loop through the original bytes and replace each byte with the mapped byte. As in

Dim map As New Dictionary(Of String, String) From {{"2g", "a3"}, {"7a", "f7"}, {"13", "11"}}

For Each token As String In {"2g", "7b", "13"}
    If map.ContainsKey(token) Then
        Debug.WriteLine(map(token))
    Else
        Debug.WriteLine("??")
    End If    
Next

No, you don't understand what I meant... Please look at my 'code', it's something what I want to get... The thing with that arrays of bytes is: I want to make a trainer for a flash game... I've got the Array of Bytes (AoB's) with Sothink SWF Maker, and I want to add them to my trainer.... If I want to play it with hacks, I must activate them with Cheat Engine and much work...

So, if the first AoB is '5a 13 ff', I want to change it to '11 a1 7f'... That's an example of AoB... So, the code in vb, what I want to put in, I want to look like this:

  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Button1.Enabled Then
            AoB("5a 13 ff") changes to ("11 a1 7f")
        End If
    End Sub

Looks to me you're using a string of hexadecimal numbers separated by a space, not an array. If you want to change the value of a string, a simple assignment statement will work, Aob = "11 a1 7f". If you want to find a substring in a string then change it, the Mid Statement, combined with the IndexOf method of the string I think will do the job.

If this is still wrong, show an example of how you are declaring the variables holding the values and how you are filling those values.

You can change the dictionary string so that

key = "5a 13 ff"
val = "11 a1 7f"

If you want to make your question clearer then you should include the declaration of AoB. The statement

Array of Bytes (AoB's) with Sothink SWF Maker

doesn't provide enough information. This is a VB.net forum. Don't expect that we will know the details of "Sothink SWF Maker".

Okay, I've tried now a new code, but, seems to not work...

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Call AxShockwaveFlash1.SetVariable("24 28 a3 a0", "24 28 a0 a0")
    End Sub
End Class

That's what I want to do, I want to change the Aob's from AxShockwaveFlash1 with a simple button click...

Could you help me?

What do you mean by "seems to not work..."?
Explain EXACTLY what you mean by Aob(Is it a string? a char array? a sequence of zeros and ones?)
We also have absolutely no idea what a AxShockwaveFlash1.SetVariable is? Could you elaborate on that please?

Okay, I want to make trainer for a flash game..

Usually, when I want to play it, I must to activate one by one (aob) with Cheat Engine, and I want to make it easier, making a trainer in vb

So, the Aob's are arrays of bytes

Something like that : a2 d1 33

So, if I want to change this aob : a2 d1 33 , I have to open cheat engine > Value Type: Array Of Bytes > First Scan > Double click on the address and change it to 02 02 02 (this is an example of AoB)...

So, my source code I want to set was the code from my last post, and, it doesn't work....

PS: When I said "seems to not work...", because it doesn't change the aob value (a2 d1 33 to 02 02 02)

You keep saying an array of bytes but what you are showing is a string of characters not an array of bytes. You been asked to show how this string is set up, but you ignore it.

Plus you seem to be using a third-party control. This means that you should be reading the dosumentation for it or at least paying attention to intellisense clues, when you are typing the code, to see what kind of structure is required. For instance when inserting, the SetVariable method for the Shockwave Flash object, Intellisense shows that it requires (name as String, value as String). So obviously trying to give it 2 values isn't going to work.

From some of your dscriptions, it seems that you are trying to change the actual code inside a shockwave flash game. This would probably be easier treating it as a regular file and search for that series of bytes, or locate a specific position in the file and change the values.

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.