ShaneIsrael/Snipping-Tool-Plus-Plus — pull request #3 by Talon876 (2014-06-14 07:09:40+00:00)
Title: Preference Refactoring

The goal of this refactor was to eliminate the dependency on the simple-json library, and replace its use with the Google gson library. Additionally, the preferences in json are now saved in a pretty print format for easier editing in an external program. However, this is also not backwards compatible with previous settings as the version number has now been removed from the preferences and the path to the preferences and now just lives in the root of the data directory.

Example `prefs.json` file for Windows with the new format:

{
//was user_capture_dir
"capture_directory_root": "C:\\Users\\\\Pictures\\SnippingTool++",
"autosave_enabled": true, //was auto.save.uploads
"editor": {
"enabled": true, //was editing.enabled
"default_tool": 0 //was default.editing.tool
}
}

The following preferences have been removed due to not being used:
- `default.upload.provider`
- `force.multi.capture`
- `version`
- `default.upload.provider`

Code changes:
* Removed simple-json dependency in favor of google gson
* Removed "version5" from preferences path
* All access to preferences should be done through the Preferences
singleton.
* Preferences moved to separate prefs package.
* Added FileReader utility class for easier consumption of files.

Example FileReader usage:

//signature: static String readFile(String pathname)
String fileContents = FileReader.readFile("path/to/file.txt");

Example reading and saving a preference:

//All properties have a corresponding get method
Preferences.getInstance().get

//And a set method
String newValue = "some new value";
Preferences.getInstance().set(newPreferenceValue);
//Whenever a set method is called, the changes are immediately saved to disk.