修复重构 ConstEncrypt后的Bug

backup
walon 2025-05-10 20:02:57 +08:00
parent 8cc1110e07
commit 2eb0a6cfc8
1 changed files with 79 additions and 93 deletions

View File

@ -137,6 +137,7 @@ namespace Obfuz.ObfusPasses.ConstEncrypt
switch (ele.Name) switch (ele.Name)
{ {
case "global": _global = ParseObfuscationRule(configFile, ele); break; case "global": _global = ParseObfuscationRule(configFile, ele); break;
case "whitelist": ParseWhitelist(configFile, ele); break;
default: throw new Exception($"Invalid xml file {configFile}, unknown node {ele.Name}"); default: throw new Exception($"Invalid xml file {configFile}, unknown node {ele.Name}");
} }
} }
@ -200,17 +201,7 @@ namespace Obfuz.ObfusPasses.ConstEncrypt
return rule; return rule;
} }
private void ParseWhitelist(string configFile, XmlElement ruleEle) private void ParseWhitelist(string configFile, XmlElement childEle)
{
foreach (XmlNode xmlNode in ruleEle.ChildNodes)
{
if (!(xmlNode is XmlElement childEle))
{
continue;
}
switch (childEle.Name)
{
case "whitelist":
{ {
string type = childEle.GetAttribute("type"); string type = childEle.GetAttribute("type");
if (string.IsNullOrEmpty(type)) if (string.IsNullOrEmpty(type))
@ -297,11 +288,6 @@ namespace Obfuz.ObfusPasses.ConstEncrypt
} }
default: throw new Exception($"Invalid xml file, unknown whitelist type {type} in {childEle.Name} node"); default: throw new Exception($"Invalid xml file, unknown whitelist type {type} in {childEle.Name} node");
} }
break;
}
default: throw new Exception($"Invalid xml file, unknown node {childEle.Name}");
}
}
} }
private ObfuscationRule GetMethodObfuscationRule(MethodDef method) private ObfuscationRule GetMethodObfuscationRule(MethodDef method)