- public void load(String filename) {
- /*
- string text = std.file.readText!(string)(filename);
- foreach (line; std.string.splitLines!(string)(text)) {
- string key;
- string bold;
- string foreColor;
- string on;
- string backColor;
- auto tokenCount = formattedRead(line, "%s = %s %s %s %s",
- &key, &bold, &foreColor, &on, &backColor);
- if (tokenCount == 4) {
- std.stdio.stderr.writefln("1 %s = %s %s %s %s",
- key, bold, foreColor, on, backColor);
-
+ public void load(String filename) throws IOException {
+ BufferedReader reader = new BufferedReader(new FileReader(filename));
+ String line = reader.readLine();
+ for (; line != null; line = reader.readLine()) {
+ String key;
+ String bold;
+ String foreColor;
+ String backColor;
+
+ // Look for lines that resemble:
+ // "key = blah on blah"
+ // "key = bold blah on blah"
+ StringTokenizer tokenizer = new StringTokenizer(line);
+ key = tokenizer.nextToken();
+ if (!tokenizer.nextToken().equals("=")) {
+ // Skip this line
+ continue;
+ }
+ bold = tokenizer.nextToken();
+ if (!bold.toLowerCase().equals("bold")) {