diff --git a/ArcadeReader.java b/ArcadeReader.java index f0e6fc5..0db2849 100644 --- a/ArcadeReader.java +++ b/ArcadeReader.java @@ -1,6 +1,8 @@ +import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -185,7 +187,7 @@ public class ArcadeReader { ArcadeReader.err(new Exception("Test \""+filename+"\" Failed:\nExpected:"+compare+"\nActual:"+r)); return; } - if (gamePath(r)==null) { + if (gamePath(r.getClass().getSimpleName())==null) { ArcadeReader.err(new Exception("Test \""+filename+"\" Failed:\nReason: gamePath for this reader type ("+r.getClass().getSimpleName()+") does not exist. Check the gamePath() function!")); return; } @@ -665,8 +667,8 @@ public class ArcadeReader { 21/*maxcombo*/, "{\"ex\":457,\"chip_scritical\":13,\"chip_critical\":15,\"chip_near\":31,\"chip_error\":201,\"long_scritical\":44,\"long_error\":241,\"vol_scritical\":91,\"vol_error\":272,\"failed\":true}"/*other*/); } - public static Path gamePath(Reader data) { - switch (data.getClass().getSimpleName()) { + public static Path gamePath(String str) { + switch (str) { case "DDRReader":{ return Paths.get("database","ddr"); } @@ -720,7 +722,7 @@ public class ArcadeReader { try { img = ImageIO.read(p.toFile()); Reader newImg = interpret(img); - Path getGamePath = gamePath(newImg); + //Path getGamePath = gamePath(newImg); newImg.interpretBoxes(p); HashMap>> DATA = sigPlace.SONG_DATABASE; List RECENT_PLAYS = sigPlace.RECENT_PLAYS; @@ -760,6 +762,34 @@ public class ArcadeReader { DATA.put(newImg.getClass().getSimpleName(),SONG_DATA); System.out.println(DATA); + new Thread(){ + public void run() { + //Threaded database update. + for (String reader : sigPlace.SONG_DATABASE.keySet()) { + Path dataPath = gamePath(reader); + for (String song : sigPlace.SONG_DATABASE.get(reader).keySet()) { + List data = sigPlace.SONG_DATABASE.get(reader).get(song); + try { + Files.write(dataPath.resolve(song), data, Charset.defaultCharset(), StandardOpenOption.CREATE,StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + List data = sigPlace.RECENT_PLAYS; + try { + Files.write(Paths.get("database","recentplays"), data, Charset.defaultCharset(), StandardOpenOption.CREATE,StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE); + } catch (IOException e) { + e.printStackTrace(); + } + data = sigPlace.RECENT_RECORDS; + try { + Files.write(Paths.get("database","recentrecords"), data, Charset.defaultCharset(), StandardOpenOption.CREATE,StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE); + } catch (IOException e) { + e.printStackTrace(); + } + } + }.start(); } catch (IOException e) { e.printStackTrace(); } diff --git a/database/popn/CYBER BeRMEA5 IC b/database/popn/CYBER BeRMEA5 IC new file mode 100644 index 0000000..b056224 --- /dev/null +++ b/database/popn/CYBER BeRMEA5 IC @@ -0,0 +1 @@ +{"game":"PopnReader","difficulty":41, "maxcombo":127, "notes":[425, 297, 127, 35, 0, 0, 0], "other":{"failed":false}, "pct":0.0, "rank":4, "score":78495, "title":"CYBER "BeRMEA5 IC"} diff --git a/database/popn/HYPER DRAMATIC Brit7aizel b/database/popn/HYPER DRAMATIC Brit7aizel new file mode 100644 index 0000000..d5329cc --- /dev/null +++ b/database/popn/HYPER DRAMATIC Brit7aizel @@ -0,0 +1 @@ +{"game":"PopnReader","difficulty":41, "maxcombo":153, "notes":[438, 305, 101, 26, 0, 0, 0], "other":{"failed":false}, "pct":0.0, "rank":4, "score":80173, "title":"HYPER DRAMATIC Brit7aizel<"} diff --git a/database/popn/HYPER JAPANESQUE 32 Ro ~Rr0AEe ~ b/database/popn/HYPER JAPANESQUE 32 Ro ~Rr0AEe ~ new file mode 100644 index 0000000..5d75364 --- /dev/null +++ b/database/popn/HYPER JAPANESQUE 32 Ro ~Rr0AEe ~ @@ -0,0 +1 @@ +{"game":"PopnReader","difficulty":40, "maxcombo":103, "notes":[496, 286, 96, 50, 0, 0, 0], "other":{"failed":false}, "pct":0.0, "rank":4, "score":80814, "title":"HYPER JAPANESQUE 32 R+o# ~Rr0AEe ~"} diff --git a/database/popn/MUpBR R K Treasure Hoard b/database/popn/MUpBR R K Treasure Hoard new file mode 100644 index 0000000..30a6df6 --- /dev/null +++ b/database/popn/MUpBR R K Treasure Hoard @@ -0,0 +1 @@ +{"game":"PopnReader","difficulty":39, "maxcombo":122, "notes":[474, 369, 107, 34, 0, 0, 0], "other":{"failed":false}, "pct":0.0, "rank":4, "score":79907, "title":"MUpBR R K Treasure Hoard"} diff --git a/database/recentplays b/database/recentplays index e69de29..9230277 100644 --- a/database/recentplays +++ b/database/recentplays @@ -0,0 +1,4 @@ +{"game":"PopnReader","difficulty":41, "maxcombo":127, "notes":[425, 297, 127, 35, 0, 0, 0], "other":{"failed":false}, "pct":0.0, "rank":4, "score":78495, "title":"CYBER "BeRMEA5 IC"} +{"game":"PopnReader","difficulty":41, "maxcombo":153, "notes":[438, 305, 101, 26, 0, 0, 0], "other":{"failed":false}, "pct":0.0, "rank":4, "score":80173, "title":"HYPER DRAMATIC Brit7aizel<"} +{"game":"PopnReader","difficulty":39, "maxcombo":122, "notes":[474, 369, 107, 34, 0, 0, 0], "other":{"failed":false}, "pct":0.0, "rank":4, "score":79907, "title":"MUpBR R K Treasure Hoard"} +{"game":"PopnReader","difficulty":40, "maxcombo":103, "notes":[496, 286, 96, 50, 0, 0, 0], "other":{"failed":false}, "pct":0.0, "rank":4, "score":80814, "title":"HYPER JAPANESQUE 32 R+o# ~Rr0AEe ~"} diff --git a/database/recentrecords b/database/recentrecords index e69de29..9230277 100644 --- a/database/recentrecords +++ b/database/recentrecords @@ -0,0 +1,4 @@ +{"game":"PopnReader","difficulty":41, "maxcombo":127, "notes":[425, 297, 127, 35, 0, 0, 0], "other":{"failed":false}, "pct":0.0, "rank":4, "score":78495, "title":"CYBER "BeRMEA5 IC"} +{"game":"PopnReader","difficulty":41, "maxcombo":153, "notes":[438, 305, 101, 26, 0, 0, 0], "other":{"failed":false}, "pct":0.0, "rank":4, "score":80173, "title":"HYPER DRAMATIC Brit7aizel<"} +{"game":"PopnReader","difficulty":39, "maxcombo":122, "notes":[474, 369, 107, 34, 0, 0, 0], "other":{"failed":false}, "pct":0.0, "rank":4, "score":79907, "title":"MUpBR R K Treasure Hoard"} +{"game":"PopnReader","difficulty":40, "maxcombo":103, "notes":[496, 286, 96, 50, 0, 0, 0], "other":{"failed":false}, "pct":0.0, "rank":4, "score":80814, "title":"HYPER JAPANESQUE 32 R+o# ~Rr0AEe ~"}