All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.pocketbyte.locolaser.ini.resource.IniResources.kt Maven / Gradle / Ivy

There is a newer version: 2.4.3
Show newest version
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)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy