import com.dowstats.configuration.StorageConfig
import com.dowstats.data.rgd.RgdData
import com.dowstats.service.w40k.IconsService
import org.junit.jupiter.api.Test
import java.io.DataInputStream
import java.io.File
import java.io.PrintWriter
import java.math.RoundingMode
import java.nio.ByteBuffer
import java.nio.file.Paths

class IconConvertScript {



    @Test
    fun testSum() {

        val iconsService = IconsService(StorageConfig())

        val folder = "D:\\home\\cnb\\mods\\Definitive_Edition2.1.1\\Data\\art\\ui\\swf"
        File(folder).walkTopDown().map {fileOrFolder ->
            println("Convert ${fileOrFolder.name}")
            if(fileOrFolder.isFile ){
                println("Convert ${fileOrFolder.name}")
                iconsService.convertTgaToJpegImage("" + fileOrFolder.name.replace(".dds", ""), fileOrFolder.path, "Converted")
            }   else {
                null
            }

        }.toList()

    }

}