Skip to content

Commit 6cd84bc

Browse files
committed
fix bug
1 parent 8215975 commit 6cd84bc

File tree

5 files changed

+10
-22
lines changed

5 files changed

+10
-22
lines changed

common/src/commonMain/kotlin/cn/kaicity/common/repository/ApkObf.kt

+6-16
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,16 @@ object ApkObf {
2727
val dexList = workDir.listFiles { name ->
2828
name.extension == "dex"
2929
}
30-
31-
val dexOut = File(workDir,"dexDump")
32-
dexOut.mkdir()
33-
3430
dexList?.forEach {
3531
logCallback.invoke("Start Obfuscator ${it.name}")
3632
val dexInputBean =
37-
InputBean(it.absolutePath, dexOut.absolutePath+"/" + it.name, inputBean.depth, inputBean.rule)
33+
InputBean(it.absolutePath, workDir.absolutePath + "/" + it.name, inputBean.depth, inputBean.rule)
3834
DexObf.run(dexInputBean, logCallback)
3935
}
4036

41-
42-
originApk.copyTo(File(inputBean.output))
43-
4437
logCallback.invoke("Start Package Apk")
4538

46-
zip(dexOut.absolutePath, inputBean.output)
39+
zip(workDir.absolutePath, originApk, targetApk)
4740

4841
} catch (e: Exception) {
4942
logCallback.invoke("Error!!!")
@@ -63,26 +56,23 @@ object ApkObf {
6356
}
6457
}
6558

66-
//todo
67-
private fun zip(path: String, apk: String) {
59+
private fun zip(path: String, origin: File, targetApk: File) {
6860
val dexList = File(path).listFiles { name ->
6961
name.extension == "dex"
7062
}?.toList()
7163

72-
ZipFile(apk).use {
64+
origin.copyTo(targetApk)
65+
ZipFile(targetApk).use {
7366
it.addFiles(dexList)
7467
}
7568

7669
}
7770

78-
//todo
71+
7972
private fun unzip(apk: String, path: String) {
8073
ZipFile(apk).use {
8174
it.extractAll(path)
8275
}
83-
8476
}
8577

86-
87-
8878
}

common/src/commonMain/kotlin/cn/kaicity/common/widget/MainView.kt

+2
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,11 @@ fun MainView(modifier: Modifier, btnClick: (InputBean) -> Unit) {
121121
depthIsError = depth.isEmpty()
122122
//pkgIsError do not need check
123123

124+
124125
if (inputIsError || outputIsError || depthIsError) {
125126
return@Button
126127
}
128+
127129
btnClick.invoke(InputBean(input, output, depth, rule))
128130
}) {
129131
Text("Obfuscator")

common/src/desktopMain/kotlin/cn/kaicity/common/platform/IFileHelper.kt

-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@ actual fun saveFile(callback:(String)->Unit) {
2222
}
2323
return callback(fileDialog.directory + fileDialog.file)
2424
}
25-

desktop/build.gradle.kts

+1-3
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@ compose.desktop {
3232
mainClass = "MainKt"
3333
nativeDistributions {
3434
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
35-
packageName = "jvm"
35+
packageName = "BlackObfuscator"
3636
packageVersion = "1.0.0"
37-
38-
appResourcesRootDir.set(project.layout.projectDirectory.dir("lib"))
3937
}
4038
}
4139
}

settings.gradle.kts

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ pluginManagement {
66
mavenCentral()
77
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
88
}
9-
9+
1010
}
1111
rootProject.name = "BlackObfuscator-GUI"
1212

1313

1414
include(":android")
1515
include(":desktop")
1616
include(":common")
17-

0 commit comments

Comments
 (0)