mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 18:44:05 +09:00
Separated langpack, concept art for inventory UI
Former-commit-id: 7a98df93b4ef50b47283abcd99576d6fbefc9cc5 Former-commit-id: db6e34417ccf84e59ba68547f30459cb4b188eb7
This commit is contained in:
@@ -2,6 +2,7 @@ package net.torvald
|
||||
|
||||
import com.google.gson.JsonObject
|
||||
import com.google.gson.JsonParser
|
||||
import java.io.File
|
||||
|
||||
import java.io.IOException
|
||||
import java.nio.file.FileSystems
|
||||
@@ -27,6 +28,17 @@ object JsonFetcher {
|
||||
return jsonObj
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun readJson(jsonFile: File): JsonObject {
|
||||
jsonString = StringBuffer() // reset buffer every time it called
|
||||
readJsonFileAsString(jsonFile.canonicalPath)
|
||||
|
||||
val jsonParser = JsonParser()
|
||||
val jsonObj = jsonParser.parse(jsonString!!.toString()).asJsonObject
|
||||
|
||||
return jsonObj
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
private fun readJsonFileAsString(path: String) {
|
||||
Files.lines(FileSystems.getDefault().getPath(path)).forEach(
|
||||
|
||||
Reference in New Issue
Block a user