Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- You are now able to have multiple settings for the app - Shows a window when updating instead of a silent update - A brand new way of handling the cache file - Removed preview button - Removed unused methods
- Loading branch information
1 parent
9536aab
commit b584244
Showing
6 changed files
with
250 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ plugins { | |
} | ||
|
||
group 'com.github.bumbleboss' | ||
version '0.6' | ||
version '0.7' | ||
|
||
sourceCompatibility = 1.8 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,32 @@ | ||
import org.json.JSONObject; | ||
|
||
import java.io.FileWriter; | ||
import java.io.IOException; | ||
import java.io.*; | ||
import java.util.Objects; | ||
|
||
public class Cache { | ||
|
||
private static String jsonData = App.readFile("./cache.json"); | ||
private static JSONObject configObject = new JSONObject(jsonData); | ||
|
||
public String getValue(String key) { | ||
return configObject == null ? "" : configObject.get(key).toString(); | ||
} | ||
private static final String jsonData = readFile(App.cache.getName()); | ||
public static JSONObject configObject = new JSONObject(Objects.requireNonNull(jsonData)); | ||
|
||
public boolean getBolValue(String key) { | ||
return configObject.getBoolean(key); | ||
private static String readFile(String fileName) { | ||
StringBuilder sb = new StringBuilder(); | ||
try { | ||
FileReader fileReader = new FileReader(fileName); | ||
try(BufferedReader br = new BufferedReader(fileReader)) { | ||
for(String line; (line = br.readLine()) != null; ) { | ||
sb.append(line).append("\n"); | ||
} | ||
} | ||
fileReader.close(); | ||
return sb.toString(); | ||
}catch (Exception ex) { | ||
if(ex instanceof FileNotFoundException) { | ||
return "File was not found"; | ||
}else{ | ||
App.logger.error(ex.getMessage(), ex); | ||
Windows.display("An error has occured", ex.getMessage()+"\n\nPlease report this to the github page.",true, true); | ||
System.exit(0); | ||
return null; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.