Fix conversion of some logical rules in Surge configurations

Optimize codes.
This commit is contained in:
Tindy X committed 2020-08-27 23:47:37 +08:00
1 parent 17628b4a30
commit e0a4194a4b
2 files changed
+3 -2

No files matched your search

+2 -2
View File
@@ -848,7 +848,7 @@ void rulesetToSurge(INIReader &base_rule, std::vector<ruleset_content> &ruleset_
}
else
{
if(count_least(strLine, ',', 3))
if(!startsWith(strLine, "AND") && !startsWith(strLine, "OR") && !startsWith(strLine, "NOT") && count_least(strLine, ',', 3))
strLine = regReplace(strLine, rule_match_regex, "$1$3$2");
}
strLine = replace_all_distinct(strLine, ",,", ",");
@@ -987,7 +987,7 @@ void rulesetToSurge(INIReader &base_rule, std::vector<ruleset_content> &ruleset_
}
else
{
if(count_least(strLine, ',', 3))
if(!startsWith(strLine, "AND") && !startsWith(strLine, "OR") && !startsWith(strLine, "NOT") && count_least(strLine, ',', 3))
strLine = regReplace(strLine, rule_match_regex, "$1$3$2");
}
allRules.emplace_back(std::move(strLine));
+1
View File
@@ -169,6 +169,7 @@ int render_template(const std::string &content, const template_args &vars, std::
switch(hash_(value))
{
case "true"_hash:
case "1"_hash:
return 1;
default:
return 0;