still wip

This commit is contained in:
minjaesong
2021-10-11 19:02:51 +09:00
parent ef603ec5d5
commit 8dbedd270e
11 changed files with 40 additions and 35 deletions

View File

@@ -684,6 +684,8 @@ fun AppUpdateListOfSavegames() {
App.savegamePlayers.clear()
App.savegameWorlds.clear()
println("listing savegames...")
// create list of worlds
(File(App.worldsDir).listFiles().filter { !it.isDirectory && !it.name.contains('.') }.map { file ->
try {
@@ -695,8 +697,12 @@ fun AppUpdateListOfSavegames() {
null
}
}.filter { it != null }.sortedByDescending { it!!.diskFile.lastModified() } as List<DiskSkimmer>).forEach {
println(it.diskFile.absolutePath)
it.rebuild() // disk skimmer was created without initialisation, so do it now
// TODO write simple and dumb SAX parser for JSON
val json = JsonReader().parse(ByteArray64Reader(it.getFile(-1L)!!.bytes, Common.CHARSET).readText())
val jsonFile = it.getFile(-1L)!!
val json = JsonReader().parse(ByteArray64Reader(jsonFile.bytes, Common.CHARSET).readText())
val worldUUID = UUID.fromString(json.get("worldIndex")!!.asString())
App.savegameWorlds[worldUUID] = it
}