06-23-2010 05:31 PM
Thanks Rolf
I had a quick go and the Inflate function returned an error?
I also tried every combination of removing any appended data (in a for loop) and still got an error.
Anyone had any luck?
06-24-2010 01:41 PM
Ok, here's what I've got so far (see screenshot and attached VI [requires OpenG Zip Tools]). Note: It doesn't seem to work yet.
Here's the process that I think the data has undergone:
So, we just need to reverse this process, which is what my example attempts (without success) to do.
06-24-2010 03:27 PM
To be clear, in what way does this fail for you? Is the inflation successful, but the result is not the icon? Do you receive an error from the Inflate function? (my problem is currently the latter, error 42)
06-24-2010 04:02 PM
Hey Chris,
Yes, I get an error out of the Inflate function -- the data that I've decoded (probably incorrectly) does not seem to be valid z-compressed data .
-Jim
06-30-2010 05:01 PM
Jim,
I spent a lot of time today looking at the code we use to write image data to our lvlib files. Since I'm not that familiar with that part of the codebase, it was slow and many things are still confusing. From what I gather, though, these are the steps we follow:
1. Convert icon to pixmap (both color and bw--not sure if these are appended to each other or what).
2. Flatten that data into a byte array.
3. Compress that byte array using ZLib Deflate.
4. Prepend the compressed data with the number of compressed bytes.
5. Prepend the above data with a header (I'm not sure if this is a variable header but in the case I looked at it was 32 bytes long). This header contains information about types/versions that LV uses when decoding the string.
I believe the steps after this (I have not yet verified) are:
1. Convert to 7-bit encoding so that the bytes are human readable.
2. Escape XML.
From what I gather, the only step you seem to be missing is stripping the header for the binary data. Of course, modifying your BD to remove the first 32 elements doesn't fix the Error 42. I'll keep pounding away at it tomorrow and see if I can get some more information.
-Sohum.
07-01-2010 02:23 PM
Hi Sohum,
Thanks for the details and for your efforts to figure this out.
Yes, it's a bit tricky working with the compressed data, because the encoding is not too obvious (until after it gets decompressed).
Thanks for your continued work and do let me know if there's anything I can do to help
Cheers,
-Jim