Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static loadAchievements (String achivFile) throws FileMissingException
- {
- // Load sprites as described in achievementFile
- File file = new File(achivFile);
- if(!file.isFile()) {
- throw new FileMissingException("Couldn't load the achievement file: " + achivFile);
- }
- // Map for achievement information
- achievementMap = new HashMap<String, AchivInfo>();
- try {
- FileReader fileReader = new FileReader(achivFile);
- BufferedReader reader = new BufferedReader(fileReader);
- String line = null;
- while ((line = reader.readLine()) != null) {
- //skip empty lines
- if (line.isEmpty())
- continue;
- // ; is for comments
- if (line.startsWith(";"))
- continue;
- // create a NEW archivInfo
- if (line = "NEW")
- ArchivInfo ai = new AchivInfo();
- String[] split = line.split(":");
- if (split.length == 2) {
- final String key = split[0].trim();
- final String val = split[1].trim();
- System.out.println("k: " + key + " v: " + val);
- // TODO alot
- switch(key) {
- case "id":
- break;
- case "detail":
- break;
- case "howto":
- break;
- case "image":
- break;
- }
- }
- }
- } catch (IOException e) {
- // rethrow a more descriptive error
- System.out.println("ouch we caught an exception!");
- }
- reader.close();
- }
Add Comment
Please, Sign In to add comment