mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-15 08:44:08 -05:00
Remove test function
This commit is contained in:
@@ -136,6 +136,7 @@ object AndroidManifestParser {
|
|||||||
val pathPattern: String? = null,
|
val pathPattern: String? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@OptIn(ExperimentalXmlUtilApi::class)
|
||||||
private val xml =
|
private val xml =
|
||||||
XML {
|
XML {
|
||||||
autoPolymorphic = false
|
autoPolymorphic = false
|
||||||
|
|||||||
@@ -16,36 +16,6 @@ object ResourceArscIconParser {
|
|||||||
val path: String,
|
val path: String,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun extractIcon(
|
|
||||||
jar: Path,
|
|
||||||
iconPath: Path,
|
|
||||||
) {
|
|
||||||
ZipFile
|
|
||||||
.builder()
|
|
||||||
.setPath(jar)
|
|
||||||
.get()
|
|
||||||
.use { zip ->
|
|
||||||
val packages =
|
|
||||||
zip
|
|
||||||
.getInputStream(zip.getEntry("resources.arsc"))
|
|
||||||
.use { ArscParser(it.readBytes()).parse() }
|
|
||||||
|
|
||||||
val icon =
|
|
||||||
packages
|
|
||||||
.flatMap { it.iconCandidates() }
|
|
||||||
.maxByOrNull { it.density }
|
|
||||||
?: return
|
|
||||||
|
|
||||||
val entry = zip.getEntry(icon.path) ?: return
|
|
||||||
|
|
||||||
zip.getInputStream(entry).use {
|
|
||||||
iconPath.outputStream().use { out ->
|
|
||||||
it.copyTo(out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun extractIcon(zip: ZipFile): InputStream {
|
fun extractIcon(zip: ZipFile): InputStream {
|
||||||
val packages =
|
val packages =
|
||||||
zip
|
zip
|
||||||
|
|||||||
Reference in New Issue
Block a user