You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
thanks a lot for ImHex! Not sure if I'm having skill issues with the Data Processor - I'm new to node-based scripting - or if it's possible at all, but here goes:
byte[]data= someData;constintrowLength=10;introwsCount= data.Length /rowLength;// assume that the length is always evenly dividable by 10for(inti=0;i<rowsCount;i++){intoffset=i*rowLength;byte[]row= data.Slice(offset, length: rowLength);// first row would be [ 01 02 03 04 ... ]
row.Reverse();// first row would now be [09 08 07 06 ...]for(intj=0;j< row.Length;j+=2){// swap bytes 2 by 2(row[j+1], row[j])=(row[j], row[j+1]);}// first row would now be done: [08 09 06 07...]
data.Write(offset, row, count: rowLength);}
I see that there are node functions that I could use like Slice and Reverse, but I don't know how to look back to read from the Read buffer or a data buffer in chunks with an incremented offset... Or how to loop at all in general.
Any help would be appreciated.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
thanks a lot for ImHex! Not sure if I'm having skill issues with the Data Processor - I'm new to node-based scripting - or if it's possible at all, but here goes:
I need to preprocess binary data as follow:
Example:
should become
The equivalent in a pseudo C# code would be:
I see that there are node functions that I could use like Slice and Reverse, but I don't know how to look back to read from the Read buffer or a data buffer in chunks with an incremented offset... Or how to loop at all in general.
Any help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions