Jump to content

Parse Huge binary file and match pattern???


 Share

Recommended Posts

I would like to find a quick way to edit multiple blocks of binary values in a large file. I have done some tests, could you tell me your best solution?

THX

PS: here you can find a huge file https://cdn.hasselblad.com/samples/x1d-II-50c/x1d-II-sample-06.3FR  50 megapixel!!!

https://www.hasselblad.com/learn/sample-images/

 

Edited by rootx
Link to comment
Share on other sites

Multiple blocks, hmm

in the while loop, where you read the data from the file, (here is a pseudo description):


Read the Starting position, compare it with the 1st byte of the 1st block, if not found, compare the 1st byte of the 2nd block, 3rd,  4th and so on.

If found, use an offset of the starting position, and compare it with the second byte. if match, repeat until the whole string matches *1, if not, continue searching the blocks from the starting position, until all of the blocks are checked.

Increase the starting position and repeat.

 

*1 If the String was found, replace the values, and add the replaced length to the starting position.

 

In this way, the script needs to go through the whole file only once. 

I do not have an autoit script file, but something similar in Blitzmax, but the code is not comparing the whole file, it only searches the defined location (mostly starting) for multiple strings/bytes.

(Edit, and the search values are hard-coded, still.)

Edited by Dan_555

Some of my script sourcecode

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...