Improve the management of file format when using FORMAT_AUTO

Improved the management of file format when using FORMAT_AUTO.
You can know load a file without specifying the format, and save it back to the same format without taking care of the actual format of the file.

- Added "detectedFormat" class variable to keep track of the format when loaded with FORMAT_AUTO.
- Added lines to affect "detectedFormat" in "load" and "parse" methods.
- Added line to use "detectedFormat" in "save" when "format" is set to FORMAT_AUTO.