diff --git a/Confuser.Core/DnlibUtils.cs b/Confuser.Core/DnlibUtils.cs index 25aa117..cfd3d06 100644 --- a/Confuser.Core/DnlibUtils.cs +++ b/Confuser.Core/DnlibUtils.cs @@ -133,6 +133,25 @@ namespace Confuser.Core { return false; } + /// + /// Determines whether the specified type is inherited from a base type. + /// + /// The type. + /// The full name of base type. + /// true if the specified type is inherited from a base type; otherwise, false. + public static bool InheritsFrom(this TypeDef type, string baseType) { + if (type.BaseType == null) + return false; + + TypeDef bas = type; + do { + bas = bas.BaseType.ResolveTypeDefThrow(); + if (bas.ReflectionFullName == baseType) + return true; + } while (bas.BaseType != null); + return false; + } + /// /// Determines whether the specified type implements the specified interface. /// diff --git a/Confuser.Renamer/AnalyzePhase.cs b/Confuser.Renamer/AnalyzePhase.cs index 5869a8f..4dfab70 100644 --- a/Confuser.Renamer/AnalyzePhase.cs +++ b/Confuser.Renamer/AnalyzePhase.cs @@ -122,6 +122,10 @@ namespace Confuser.Renamer { if (type.InheritsFromCorlib("System.Attribute")) { service.ReduceRenameMode(type, RenameMode.ASCII); } + + if (type.InheritsFrom("System.Configuration.SettingsBase")) { + service.SetCanRename(type, false); + } } void Analyze(NameService service, ConfuserContext context, ProtectionParameters parameters, MethodDef method) {