diff --git a/src/main/kotlin/org/bm00/DataAccessor/Config.kt b/src/main/kotlin/org/bm00/DataAccessor/Config.kt deleted file mode 100644 index 00bea9f..0000000 --- a/src/main/kotlin/org/bm00/DataAccessor/Config.kt +++ /dev/null @@ -1,44 +0,0 @@ -package org.bm00.DataAccessor - -import dev.dirs.ProjectDirectories -import jexer.TApplication -import java.io.File -import java.io.FileInputStream -import java.io.FileOutputStream -import java.io.OutputStream -import java.nio.file.Files -import java.nio.file.Paths -import java.util.* -import kotlin.jvm.Throws - -val prop = Properties() - -class Config { - val confDir = ProjectDirectories.from("org", "bm00", "osda") - val runDir = File(confDir.configDir) - val confFile = File(confDir.configDir + "/osda.cfg") - private val prop = Properties() - private var runDirExists = runDir.exists() - init { - //Check if the directories and files exist, if not, create them. Also check if config version is incorrect. - if(!runDirExists){ - Files.createDirectories(Paths.get(confDir.configDir)) - } - if(confFile.exists()) { - FileInputStream(confFile).use { prop.load(it) } - } - //Otherwise create the necessary directories - else{ - Files.createFile(Paths.get(confDir.configDir + "/osda.cfg")) - FileInputStream(confFile).use { - prop.load(it) - prop.setProperty("configVersion", "1") - } - val out: OutputStream = FileOutputStream(confFile) - prop.store(out, "Org Secure Data Accessor - OSDA Config file") - } - } - //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 = (prop.getProperty("configVersion")).toInt() -} \ No newline at end of file diff --git a/src/main/kotlin/org/bm00/dataAccessor/Config.kt b/src/main/kotlin/org/bm00/dataAccessor/Config.kt new file mode 100644 index 0000000..75a8262 --- /dev/null +++ b/src/main/kotlin/org/bm00/dataAccessor/Config.kt @@ -0,0 +1,78 @@ +package org.bm00.dataAccessor + +import dev.dirs.ProjectDirectories +import java.io.File +import java.io.FileInputStream +import java.io.FileOutputStream +import java.io.OutputStream +import java.nio.file.Files +import java.nio.file.Paths +import java.util.* + +val prop = Properties() + +class Config { + val confDir = ProjectDirectories.from("org", "bm00", "osda") + val runDir = File(confDir.configDir) + val confFile = File(confDir.configDir + "/osda.cfg") + private val prop = Properties() + private var runDirExists = runDir.exists() + init { + //Check if the directories and files exist, if not, create them. Also check if config version is incorrect. + if(!runDirExists){ + Files.createDirectories(Paths.get(confDir.configDir)) + } + if(confFile.exists()) { + FileInputStream(confFile).use { prop.load(it) } + } + //Otherwise create the necessary directories + else{ + Files.createFile(Paths.get(confDir.configDir + "/osda.cfg")) + FileInputStream(confFile).use { + prop.load(it) + prop.setProperty("configVersion", "1") + } + val out: OutputStream = FileOutputStream(confFile) + prop.store(out, "Org Secure Data Accessor - OSDA Config file") + } + + //Set Jexer Colors + // SWING + System.setProperty("jexer.Swing.color1", "#11111b") + System.setProperty("jexer.Swing.color2", "#a6e3a1") + System.setProperty("jexer.Swing.color3", "#a6e3a1") + System.setProperty("jexer.Swing.color4", "#1e1e2e") + System.setProperty("jexer.Swing.color5", "#f9e2af") + System.setProperty("jexer.Swing.color6", "#89dceb") + System.setProperty("jexer.Swing.color7", "#7f849c") + System.setProperty("jexer.Swing.color8", "#181825") + System.setProperty("jexer.Swing.color9", "#eba0ac") + System.setProperty("jexer.Swing.color10", "#94e2d5") + System.setProperty("jexer.Swing.color11", "#fab387") + System.setProperty("jexer.Swing.color12", "#74c7ec") + System.setProperty("jexer.Swing.color13", "#cba6f7") + System.setProperty("jexer.Swing.color14", "#b4befe") + System.setProperty("jexer.Swing.color15", "#94e2d5") + + // ECM48 + System.setProperty("jexer.ECM48.color1", "#11111b") + System.setProperty("jexer.ECM48.color2", "#a6e3a1") + System.setProperty("jexer.ECM48.color3", "#a6e3a1") + System.setProperty("jexer.ECM48.color4", "#1e1e2e") + System.setProperty("jexer.ECM48.color5", "#f9e2af") + System.setProperty("jexer.ECM48.color6", "#89dceb") + System.setProperty("jexer.ECM48.color7", "#7f849c") + System.setProperty("jexer.ECM48.color8", "#181825") + System.setProperty("jexer.ECM48.color9", "#eba0ac") + System.setProperty("jexer.ECM48.color10", "#94e2d5") + System.setProperty("jexer.ECM48.color11", "#fab387") + System.setProperty("jexer.ECM48.color12", "#74c7ec") + System.setProperty("jexer.ECM48.color13", "#cba6f7") + System.setProperty("jexer.ECM48.color14", "#b4befe") + System.setProperty("jexer.ECM48.color15", "#94e2d5") + + } + //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 = (prop.getProperty("configVersion")).toInt() +} \ No newline at end of file