pull/49/head
Celeter 5 years ago
parent 2af5ce705c
commit 76f8b020c4
  1. 13
      app/src/main/java/io/legado/app/help/storage/OldRule.kt

@ -102,7 +102,9 @@ object OldRule {
private fun toNewRule(oldRule: String?): String? { private fun toNewRule(oldRule: String?): String? {
if (oldRule.isNullOrBlank()) return null if (oldRule.isNullOrBlank()) return null
var newRule = oldRule var newRule = oldRule
var reverse = false
if (oldRule.startsWith("-")) { if (oldRule.startsWith("-")) {
reverse = true
newRule = oldRule.substring(1) newRule = oldRule.substring(1)
} }
if (!newRule.startsWith("@CSS:", true) && if (!newRule.startsWith("@CSS:", true) &&
@ -116,8 +118,12 @@ object OldRule {
} }
if (newRule.contains("|") && !newRule.contains("||")) { if (newRule.contains("|") && !newRule.contains("||")) {
if (newRule.contains("##")) { if (newRule.contains("##")) {
if (newRule.split("##")[0].contains("|")) { var list = newRule.split("##")
newRule = newRule.replace("|", "||") if (list[0].contains("|")) {
newRule = list[0].replace("|", "||")
for (i in 1 until list.size - 1) {
newRule += "##" + list[i]
}
} }
} else { } else {
newRule = newRule.replace("|", "||") newRule = newRule.replace("|", "||")
@ -127,6 +133,9 @@ object OldRule {
newRule = newRule.replace("&", "&&") newRule = newRule.replace("&", "&&")
} }
} }
if (reverse) {
newRule += "-"
}
return newRule return newRule
} }

Loading…
Cancel
Save