| 280 | } |
| 281 | |
| 282 | private static int parseConfig(List<String> lines, Map<String,Object> config) { |
| 283 | int i = 0; |
| 284 | while(i < lines.size()) { |
| 285 | String ith = lines.get(i); |
| 286 | if(ith.startsWith("===")) { |
| 287 | return i + 1; |
| 288 | } else { |
| 289 | String[] split = ith.split("="); |
| 290 | String key = split[0]; |
| 291 | String val = split[1]; |
| 292 | if(config.containsKey(key)) { |
| 293 | throw new IllegalArgumentException("duplicate key encountered (\"" + key + "\")"); |
| 294 | } if(val.charAt(0) == '"') { |
| 295 | // Strip quotes |
| 296 | config.put(key, val.substring(1, val.length() - 1)); |
| 297 | } else if(Character.isDigit(val.charAt(0))) { |
| 298 | config.put(key, Integer.parseInt(val)); |
| 299 | } else { |
| 300 | config.put(key, Boolean.parseBoolean(val)); |
| 301 | } |
| 302 | } |
| 303 | i = i + 1; |
| 304 | } |
| 305 | return i; |
| 306 | } |
| 307 | |
| 308 | private static int parseFrame(int i, List<String> lines, List<Frame> frames) { |
| 309 | ArrayList<Action> actions = new ArrayList<>(); |