public void AddMatchingInterfaces() { foreach (var interfaceMatch in Config.InterfaceMatches) { var matchConfigExists = !string.IsNullOrEmpty(interfaceMatch.Match); var matchRegEx = matchConfigExists ? new Regex(interfaceMatch.Match) : null; var excludeMatchConfigExists = !string.IsNullOrEmpty(interfaceMatch.ExcludeMatch); var excludeMatchRegEx = excludeMatchConfigExists ? new Regex(interfaceMatch.ExcludeMatch) : null; var baseTypeNameConfigExists = !string.IsNullOrEmpty(interfaceMatch.BaseTypeName); if (baseTypeNameConfigExists) { var baseType = TypeService.GetTypeDefinition(interfaceMatch.BaseTypeName); AddInterfaceNode(baseType); } foreach (var type in TypeService.Types) { var isMatch = matchRegEx != null && matchRegEx.IsMatch(type.FullName) && (!excludeMatchConfigExists || !excludeMatchRegEx.IsMatch(type.FullName)); var doesBaseTypeMatch = !baseTypeNameConfigExists || TypeService.GetBaseTypes(type).Any(t => t.FullName.EndsWith(interfaceMatch.BaseTypeName)); if (isMatch && doesBaseTypeMatch) { AddInterfaceNode(type); } } } }