diff --git a/src/main/kotlin/org/bm00/DataAccessor/Config.kt b/src/main/kotlin/org/bm00/DataAccessor/Config.kt index 24dee83..694367c 100644 --- a/src/main/kotlin/org/bm00/DataAccessor/Config.kt +++ b/src/main/kotlin/org/bm00/DataAccessor/Config.kt @@ -1,6 +1,7 @@ package org.bm00.DataAccessor import dev.dirs.ProjectDirectories +import jexer.TApplication import java.io.File import java.io.FileInputStream import java.io.FileOutputStream @@ -8,6 +9,7 @@ import java.io.OutputStream import java.nio.file.Files import java.nio.file.Paths import java.util.* +import kotlin.jvm.Throws val prop = Properties() @@ -31,6 +33,7 @@ class Config { FileInputStream(confFile).use { prop.load(it) prop.setProperty("configVersion", "1") + prop.setProperty("backendType", "SWING") } val out: OutputStream = FileOutputStream(confFile) prop.store(out, "Org Secure Data Accessor - OSDA Config file") @@ -39,4 +42,19 @@ class Config { //Convert values from the config file to in-code variables, // so we can use them later, also make them public because I said so. val configVersion: Int = (prop.getProperty("configVersion")).toInt() + + // Possible answers: SWING, XTERM, ECMA48 + val backendType = + if (prop.getProperty("backendType") == "SWING") { + TApplication.BackendType.SWING + } + else if (prop.getProperty("backendType") == "XTERM") { + TApplication.BackendType.XTERM + } + else if (prop.getProperty("backendType") == "ECMA48") { + TApplication.BackendType.ECMA48 + } + else { + throw Exception("Improper Backend set! Please use `SWING, XTERM, ECMA48`!") + } } \ No newline at end of file diff --git a/src/main/kotlin/org/bm00/DataAccessor/main.kt b/src/main/kotlin/org/bm00/DataAccessor/main.kt index 46ee9d6..cd0da04 100644 --- a/src/main/kotlin/org/bm00/DataAccessor/main.kt +++ b/src/main/kotlin/org/bm00/DataAccessor/main.kt @@ -4,13 +4,15 @@ import jexer.TApplication import org.bm00.DataAccessor.windows.WelcomeWindow import java.util.* -// This creates a Jexer application (and calls the "backend type" which is how its rendered) -class Application : TApplication(BackendType.SWING) { +val backendType = Config().backendType + +class Application : TApplication(backendType, 80, 40, 18) { init { WelcomeWindow(this) } } +// This creates a Jexer application (and calls the "backend type" which is how its rendered) @Throws(Exception::class) fun main(args: Array) { Runtime.getRuntime().exec("echo Hello-World") @@ -18,3 +20,4 @@ fun main(args: Array) { val app = Application() app.run() } +