Rename getField() to getFieldByName() and add a real getField() method
This commit is contained in:
parent
8999eb8e0f
commit
ff55be46b6
|
@ -472,7 +472,17 @@ namespace de4dot.blocks {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FieldDefinition getField(TypeDefinition type, string name) {
|
public static FieldDefinition getField(TypeDefinition type, string typeFullName) {
|
||||||
|
if (type == null)
|
||||||
|
return null;
|
||||||
|
foreach (var field in type.Fields) {
|
||||||
|
if (field.FieldType.FullName == typeFullName)
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FieldDefinition getFieldByName(TypeDefinition type, string name) {
|
||||||
if (type == null)
|
if (type == null)
|
||||||
return null;
|
return null;
|
||||||
foreach (var field in type.Fields) {
|
foreach (var field in type.Fields) {
|
||||||
|
|
|
@ -156,7 +156,7 @@ namespace de4dot.code.deobfuscators.Babel_NET {
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkVersion(TypeDefinition attr) {
|
void checkVersion(TypeDefinition attr) {
|
||||||
var versionField = DotNetUtils.getField(attr, "Version");
|
var versionField = DotNetUtils.getFieldByName(attr, "Version");
|
||||||
if (versionField != null && versionField.IsLiteral && versionField.Constant != null && versionField.Constant is string) {
|
if (versionField != null && versionField.IsLiteral && versionField.Constant != null && versionField.Constant is string) {
|
||||||
var val = Regex.Match((string)versionField.Constant, @"^(\d+\.\d+\.\d+\.\d+)$");
|
var val = Regex.Match((string)versionField.Constant, @"^(\d+\.\d+\.\d+\.\d+)$");
|
||||||
if (val.Groups.Count < 2)
|
if (val.Groups.Count < 2)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user