rootx Posted August 9, 2020 Share Posted August 9, 2020 (edited) 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 August 13, 2020 by rootx Link to comment Share on other sites More sharing options...
Dan_555 Posted August 9, 2020 Share Posted August 9, 2020 (edited) 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 August 9, 2020 by Dan_555 Some of my script sourcecode Link to comment Share on other sites More sharing options...
rootx Posted August 10, 2020 Author Share Posted August 10, 2020 Thanks for the answer, anyone want in on my question? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now