From 76f8b020c4af4c29d67e119a7834bc7f983cf0ca Mon Sep 17 00:00:00 2001 From: Celeter Date: Sun, 1 Dec 2019 00:39:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/help/storage/OldRule.kt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/storage/OldRule.kt b/app/src/main/java/io/legado/app/help/storage/OldRule.kt index f78aaa60b..126dcf076 100644 --- a/app/src/main/java/io/legado/app/help/storage/OldRule.kt +++ b/app/src/main/java/io/legado/app/help/storage/OldRule.kt @@ -102,7 +102,9 @@ object OldRule { private fun toNewRule(oldRule: String?): String? { if (oldRule.isNullOrBlank()) return null var newRule = oldRule + var reverse = false if (oldRule.startsWith("-")) { + reverse = true newRule = oldRule.substring(1) } if (!newRule.startsWith("@CSS:", true) && @@ -116,8 +118,12 @@ object OldRule { } if (newRule.contains("|") && !newRule.contains("||")) { if (newRule.contains("##")) { - if (newRule.split("##")[0].contains("|")) { - newRule = newRule.replace("|", "||") + var list = newRule.split("##") + if (list[0].contains("|")) { + newRule = list[0].replace("|", "||") + for (i in 1 until list.size - 1) { + newRule += "##" + list[i] + } } } else { newRule = newRule.replace("|", "||") @@ -127,6 +133,9 @@ object OldRule { newRule = newRule.replace("&", "&&") } } + if (reverse) { + newRule += "-" + } return newRule }