Skip to content

Commit

Permalink
feat(plugin-image): 集成StegSolve
Browse files Browse the repository at this point in the history
  • Loading branch information
Leon406 committed Dec 17, 2022
1 parent 7f228f0 commit e49d93c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
3 changes: 2 additions & 1 deletion plugin-image/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group = "me.leon.toolsfx"
version = "1.0.0"
version = "1.1.0"

plugins {
`java-library`
Expand All @@ -18,6 +18,7 @@ javafx {
}

dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to arrayOf("*.jar"))))
implementation(project(":plugin-lib"))
implementation(project(":app"))
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
Expand Down
Binary file added plugin-image/libs/StegSolve-1.5-alpha1.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
package me.leon.toolsfx.plugin

import java.io.File
import javafx.beans.property.SimpleBooleanProperty
import javafx.geometry.Pos
import javafx.scene.control.RadioButton
import javafx.scene.control.TextArea
import javafx.scene.image.Image
import javafx.scene.image.ImageView
import me.leon.*
import me.leon.ext.*
import me.leon.ext.fx.*
import me.leon.toolsfx.plugin.ext.*
import me.leon.ext.DEFAULT_SPACING
import me.leon.ext.cast
import me.leon.ext.fx.clipboardText
import me.leon.ext.fx.copy
import me.leon.ext.fx.fileDraggedHandler
import me.leon.ext.properText
import me.leon.ext.toFile
import me.leon.toolsfx.plugin.ext.ImageServiceType
import me.leon.toolsfx.plugin.ext.locationServiceType
import me.leon.toolsfx.plugin.ext.serviceTypeMap
import tornadofx.*

class ImageProcessView : PluginFragment("ImageProcessView") {
override val version = "v1.0.0"
override val date: String = "2022-12-15"
override val version = "v1.1.0"
override val date: String = "2022-12-17"
override val author = "Leon406"
override val description = "图片模块"
private var taInput: TextArea by singleAssign()
Expand Down Expand Up @@ -113,6 +121,7 @@ class ImageProcessView : PluginFragment("ImageProcessView") {
taOutput.text = ""
}
}
button("stegSolve") { action { startStegSolve() } }
}

stackpane {
Expand Down Expand Up @@ -141,4 +150,28 @@ class ImageProcessView : PluginFragment("ImageProcessView") {
}
}
}

companion object {
private val javaHome = System.getProperty("java.home")
private val userDir = System.getProperty("user.dir")
private var command: Array<String>? = null

init {
userDir
.toFile()
.walk()
.find { it.extension == "jar" && it.name.startsWith("StegSolve") }
?.run {
command =
arrayOf(
"$javaHome${File.separator}bin${File.separator}java",
"-jar",
"-Dsun.java2d.uiScale=${ToolsApp.scale}",
absolutePath
)
}
}

private fun startStegSolve() = Runtime.getRuntime().exec(command)
}
}

0 comments on commit e49d93c

Please sign in to comment.