- this way the following xml will match all the types in the assembly
MyAssembly
<linker>
<assembly fullname="MyAssembly">
<namespace type="*" />
</assembly>
</linker>
before this change it will only match the types defined in main
module and none of the nested types
return new Regex (pattern.Replace(".", @"\.").Replace("*", "(.*)"));
}
return new Regex (pattern.Replace(".", @"\.").Replace("*", "(.*)"));
}
+ void MatchType (TypeDefinition type, Regex regex, XPathNavigator nav)
+ {
+ if (regex.Match (type.FullName).Success)
+ ProcessType (type, nav);
+
+ if (!type.HasNestedTypes)
+ return;
+
+ foreach (var nt in type.NestedTypes)
+ MatchType (nt, regex, nav);
+ }
+
void ProcessTypePattern (string fullname, AssemblyDefinition assembly, XPathNavigator nav)
{
Regex regex = CreateRegexFromPattern (fullname);
foreach (TypeDefinition type in assembly.MainModule.Types) {
void ProcessTypePattern (string fullname, AssemblyDefinition assembly, XPathNavigator nav)
{
Regex regex = CreateRegexFromPattern (fullname);
foreach (TypeDefinition type in assembly.MainModule.Types) {
- if (!regex.Match (type.FullName).Success)
- continue;
-
- ProcessType (type, nav);
+ MatchType (type, regex, nav);