private static void GenerateMembers(AType holder, IType type) { var fldHolder = holder as IHasFields; if (fldHolder != null) { foreach (var fld in type.Fields.Values) { var myFld = Noast.Create <IField>(fld.Name); myFld.Type = Simplify(DerivedClassDeobfuscate(fld.Type)); fldHolder.Fields.Add(myFld); } } var methHolder = holder as IHasMethods; if (methHolder != null) { foreach (var meth in type.Methods.Values) { var myMeth = Noast.Create <IMethod>(meth.Name); var parmIndex = 0; foreach (var parm in meth.Parameters) { var parmName = parm.Name; if (string.IsNullOrWhiteSpace(parmName)) { parmName = $"parm{parmIndex++}"; } parmName = ToName(Deobfuscate(parmName)); var parmType = Simplify(DerivedClassDeobfuscate(parm.Type)); var parmMod = default(ParamModifier?); if (parm.Type.EndsWith("&")) { parmMod = ParamModifier.Ref; } myMeth.AddParameter(parmName, parmType, parmMod); } myMeth.ReturnType = Simplify(DerivedClassDeobfuscate(meth.ReturnType)); methHolder.Methods.Add(myMeth); } } }
private static bool HasNativeMethod(IType type) => type.Methods.Any(m => m.Value.Aliases.Any());
private static bool IsAttribute(IType type) => type.Name.EndsWith("Attribute");