Merge branch 'master' into confuser

This commit is contained in:
de4dot 2012-08-16 01:06:13 +02:00
commit 9e4fa4511b
2 changed files with 8 additions and 3 deletions

View File

@ -754,11 +754,11 @@ namespace de4dot.blocks {
}
}
public static IEnumerable<CustomAttribute> findAttributes(AssemblyDefinition asm, TypeReference attr) {
public static IEnumerable<CustomAttribute> findAttributes(ICustomAttributeProvider custAttrProvider, TypeReference attr) {
var list = new List<CustomAttribute>();
if (asm == null)
if (custAttrProvider == null)
return list;
foreach (var cattr in asm.CustomAttributes) {
foreach (var cattr in custAttrProvider.CustomAttributes) {
if (MemberReferenceHelper.compareTypes(attr, cattr.AttributeType))
list.Add(cattr);
}

View File

@ -691,6 +691,11 @@ namespace de4dot.code.deobfuscators {
return list.Count == 0 ? null : list[0];
}
protected CustomAttribute getModuleAttribute(TypeReference attr) {
var list = new List<CustomAttribute>(DotNetUtils.findAttributes(module, attr));
return list.Count == 0 ? null : list[0];
}
protected bool hasMetadataStream(string name) {
foreach (var stream in module.MetadataStreams) {
if (stream.Name == name)