pull/38/head
kunfei 5 years ago
parent 810f9362e5
commit 4e94e0e279
  1. 4
      app/src/main/java/io/legado/app/help/JsExtensions.kt
  2. 20
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt
  3. 4
      app/src/main/java/io/legado/app/utils/EncoderUtils.kt

@ -29,6 +29,10 @@ object JsExtensions {
return EncoderUtils.base64Decoder(str)
}
fun base64Encoder(str: String): ByteArray? {
return EncoderUtils.base64Encoder(str)
}
fun strToMd5By32(str: String?): String? {
return MD5Utils.strToMd5By32(str)
}

@ -576,6 +576,18 @@ class AnalyzeRule(private var book: BaseBook? = null) {
return EncoderUtils.base64Decoder(str)
}
fun base64Encoder(str: String): ByteArray? {
return EncoderUtils.base64Encoder(str)
}
fun strToMd5By32(str: String?): String? {
return MD5Utils.strToMd5By32(str)
}
fun strToMd5By16(str: String?): String? {
return MD5Utils.strToMd5By16(str)
}
/**
* 章节数转数字
*/
@ -592,14 +604,6 @@ class AnalyzeRule(private var book: BaseBook? = null) {
}
}
fun strToMd5By32(str: String?): String? {
return MD5Utils.strToMd5By32(str)
}
fun strToMd5By16(str: String?): String? {
return MD5Utils.strToMd5By16(str)
}
companion object {
private val putPattern = Pattern.compile("@put:(\\{[^}]+?\\})", Pattern.CASE_INSENSITIVE)
private val getPattern = Pattern.compile("@get:\\{([^}]+?)\\}", Pattern.CASE_INSENSITIVE)

@ -32,4 +32,8 @@ object EncoderUtils {
String(bytes)
}
}
fun base64Encoder(str: String): ByteArray? {
return Base64.encode(str.toByteArray(), Base64.DEFAULT)
}
}
Loading…
Cancel
Save