Skip to content

Commit

Permalink
feat: 🎸 コンフィグを保存するメソッドの追加
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueSheep2804 committed Jul 12, 2023
1 parent eea1729 commit d9a1481
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ class SeleneChatConfigManager(private val file: File) {
config = yaml.decodeFromStream(SeleneChatConfigData.serializer(), configFileInputStream)
}

fun save() {
val configFile = File(file, "config.yml")
if (!file.exists()) {
file.mkdir()
}
val output = FileOutputStream(configFile)
yaml.encodeToStream(SeleneChatConfigData.serializer(), config, output)
}

fun checkVersion(): String {
return if (config.configVersion < SeleneChatConfigData().configVersion) SeleneChat.resource.configVersionOutdated
else if (config.configVersion > SeleneChatConfigData().configVersion) SeleneChat.resource.configVersionNewer
Expand Down

0 comments on commit d9a1481

Please sign in to comment.