1
0
Fork 0
mirror of https://gitlab.com/kauron/jstudy synced 2024-06-26 13:33:02 +02:00

Config: defaults

This commit is contained in:
Carlos Galindo 2016-06-12 16:39:10 +02:00
parent 51779fb868
commit c83f765c35
Signed by: kauron
GPG key ID: 83E68706DEE119A3

View file

@ -22,19 +22,24 @@ public class AppConfig {
}
public static void load() {
try {
Scanner in = new Scanner(new File(FILE));
while (in.hasNextLine()) {
String line = in.nextLine();
String value = line.substring(line.indexOf('=') + 1);
if (line.matches("repeatWrong=.*"))
repeatWrong = Boolean.parseBoolean(value);
else if (line.matches("showFeedback=.*"))
showFeedback = Boolean.parseBoolean(value);
File file = new File(FILE);
if (!file.exists()) {
repeatWrong = true;
showFeedback = true;
} else
try {
Scanner in = new Scanner(new File(FILE));
while (in.hasNextLine()) {
String line = in.nextLine();
String value = line.substring(line.indexOf('=') + 1);
if (line.matches("repeatWrong=.*"))
repeatWrong = Boolean.parseBoolean(value);
else if (line.matches("showFeedback=.*"))
showFeedback = Boolean.parseBoolean(value);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public static String printValues() {