working poc

This commit is contained in:
2026-03-10 00:36:59 +05:00
parent 881dbfb648
commit a319a07440
34 changed files with 2067 additions and 37 deletions

View File

@@ -0,0 +1,32 @@
package sh.sar.isodroid.data
import java.io.File
data class IsoFile(
val path: String,
val name: String,
val size: Long
) {
companion object {
fun fromFile(file: File): IsoFile {
return IsoFile(
path = file.absolutePath,
name = file.name,
size = file.length()
)
}
}
val formattedSize: String
get() {
val kb = size / 1024.0
val mb = kb / 1024.0
val gb = mb / 1024.0
return when {
gb >= 1.0 -> String.format("%.2f GB", gb)
mb >= 1.0 -> String.format("%.2f MB", mb)
kb >= 1.0 -> String.format("%.2f KB", kb)
else -> "$size B"
}
}
}