ru.pocketbyte.locolaser.ini.resource.IniResources.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of resource-ini Show documentation
Show all versions of resource-ini Show documentation
Implementation of platform for LocoLaser tool to work with ini resources.
package ru.pocketbyte.locolaser.ini.resource
import ru.pocketbyte.locolaser.ini.resource.file.IniResourceFile
import ru.pocketbyte.locolaser.resource.AbsResources
import ru.pocketbyte.locolaser.resource.file.ResourceFile
import ru.pocketbyte.locolaser.resource.formatting.FormattingType
import ru.pocketbyte.locolaser.resource.formatting.JavaFormattingType
import ru.pocketbyte.locolaser.summary.FileSummary
import java.io.File
class IniResources(
resourcesDir: File,
fileName: String,
filter: ((key: String) -> Boolean)?
) : AbsResources(resourcesDir, fileName, filter) {
override val formattingType: FormattingType = JavaFormattingType
private val resourceFile: File
get() {
val localeFolder = File(directory, "/")
localeFolder.mkdirs()
return File(localeFolder, "$name.ini")
}
override fun getResourceFiles(locales: Set?): Array? {
return arrayOf(IniResourceFile(resourceFile, locales))
}
override fun summaryForLocale(locale: String): FileSummary {
return FileSummary(resourceFile)
}
}