mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 19:44:05 +09:00
quickslot selections are controlled by the ingame rather than the 'bar UI'
This commit is contained in:
@@ -1,17 +1,12 @@
|
||||
package net.torvald.terrarum.utils
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonElement
|
||||
import com.google.gson.JsonObject
|
||||
|
||||
import java.io.FileWriter
|
||||
import java.io.IOException
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2016-03-04.
|
||||
*/
|
||||
object JsonWriter {
|
||||
|
||||
private val formattingRegex = Regex("""(?<=[\{,\[])|(?=[\]}])""")
|
||||
|
||||
/**
|
||||
* serialise a class to the file as JSON, using Google GSON.
|
||||
*
|
||||
@@ -23,7 +18,7 @@ object JsonWriter {
|
||||
val classElem = com.google.gson.Gson().toJsonTree(c)
|
||||
val jsonString = classElem.toString()
|
||||
val writer = java.io.FileWriter(path)
|
||||
writer.write(jsonString)
|
||||
writer.write(jsonString.replace(formattingRegex, "\n"))
|
||||
writer.close()
|
||||
}
|
||||
|
||||
@@ -36,7 +31,7 @@ object JsonWriter {
|
||||
@Throws(java.io.IOException::class)
|
||||
fun writeToFile(jsonObject: com.google.gson.JsonObject, path: String) {
|
||||
val writer = java.io.FileWriter(path)
|
||||
writer.write(jsonObject.toString())
|
||||
writer.write(jsonObject.toString().replace(formattingRegex, "\n"))
|
||||
writer.close()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user