Open MarqueIV opened 3 years ago
By the way, here's a link to my fork of your work. The other thing I did was modified your vr180ToEquiPhoto to prompt you for a directory of vr180 photos so it can convert them all in a batch rather than you having to batch them externally. You also have the option to rename them, and if you do, it will auto-generate number suffixes for you.
Feel free to crib any of that and pull back into yours. Happy to help! :)
Hey! Found your project tonight and it was exactly what I needed! Thanks!! However, your Base64 padding calculation is incorrect.
Specifically, in
JpegParser.cs
in theProcessExtendedXMPXML
function, you're running a mod 4 on the length of the data, which returns the count of the chars that don't perfectly align on a four-byte boundary. In the case of Base64, that will always return 0, 2 or 3. The problem is you're using that value as the index into the substring "==" which is incorrect, and in the case of 3, crashes the app.What you should be doing is padding the string to align on a multiple of four characters, meaning when you get 2 you pad with 2 but when you get a 3, you only pad with 1, and of course when you get back 0, you don't pad at all.
Here's the code you can use to get the correct padding which fixes your crash...
Note: Normally I'd make a PR for you, but I've heavily modified your files so much it would be more work than just sharing this with you.
Hope this helps!