NRCan / GSC-Field-Application

Geological Survey Canada on site data collection for geologists.
Other
9 stars 1 forks source link

Field book backup - fails on zip with over 2 Gb of data #333

Closed ghuotvez closed 3 months ago

ghuotvez commented 3 months ago

When loading tons of TPK and trying to backup a field book, which results in a copy of all those tpks, sometimes it fails.

System.OverflowException: 'Arithmetic operation resulted in an overflow.'

https://stackoverflow.com/questions/8070949/arithmetic-operation-resulted-in-an-overflow-error-for-byte-arrays-in-c-shar

ghuotvez commented 3 months ago

So the problem is the variable in the byte array that can be bigger then 2Gb. We need to find another way of working that out.

ghuotvez commented 3 months ago

@jameljoseph I was able to get a fix for this, although it's not a perfect one. In order to bypass the 2Gb limit I used the old zipfile class. It dates a bit and can't be launched in async mode, so that means if someone has more then 2Gb of data, it takes a really long time. I added a warning to tell user about this lenghty process.