private void PopulateMethods(TypeDefinition cecilType, MemberItem parentItem) { foreach (var method in cecilType.Methods) { if (!m_ScanForPrivateMembers && !method.IsPublic) { continue; } if (method.IsGetter || method.IsSetter) { continue; } AssemblyType asmType = AssemblyType.Method; var methodName = method.Name; if (method.IsConstructor) { methodName = "constructor"; asmType = AssemblyType.Constructor; } else if (methodName.StartsWith("op_Implicit")) { methodName = method.ReturnType.ToString().SimplifyTypes(); asmType = AssemblyType.ImplOperator; } else if (methodName.StartsWith("op_")) { methodName = StringConvertUtils.ConvertOperatorFromAssembly(methodName).Substring(3); // Skip the op_ part asmType = AssemblyType.Operator; } string modifier = ""; if (method.IsStatic) { modifier = "static"; } var asmEntry = new AsmEntry(methodName, asmType, modifier); foreach (var param in method.Parameters) { string paramType = param.ParameterType.ToString().SimplifyTypes(); bool paramAttribute = IsParams(param); string paramModifiers = paramAttribute? "params": ""; var paramElement = new ParamElement(param.Name, paramType, paramModifiers); asmEntry.ParamList.Add(paramElement); } foreach (GenericParameter param in method.GenericParameters) { string paramType = param.GetElementType().ToString().SimplifyTypes(); asmEntry.GenericParamList.Add(paramType); } asmEntry.ReturnType = method.ReturnType.ToString().SimplifyTypes(); var signatureName = MemberNameGenerator.SignatureNameFromMethodDefinition(method); HandleMemberAndSignature(GetMemberName(method), signatureName, asmEntry, parentItem); } }
private void PopulateDelegate(TypeDefinition del) { var asmEntry = new AsmEntry(del.Name, AssemblyType.Delegate); var signatureName = MemberNameGenerator.SignatureNameFromDelegate(del); HandleMemberAndSignature(GetTypeName(del), signatureName, asmEntry, null); }
private void PopulateProperties(TypeDefinition cecilType, MemberItem parentItem) { foreach (PropertyDefinition prop in cecilType.Properties) { if (!m_ScanForPrivateMembers && (prop.GetMethod != null && !prop.GetMethod.IsPublic)) { continue; } var signatureName = MemberNameGenerator.SignatureNameFromPropertyDefinition(prop); AsmEntry asm = new AsmEntry(signatureName, AssemblyType.Property) { ReturnType = prop.PropertyType.ToString().SimplifyTypes() }; HandleMemberAndSignature(GetMemberName(prop), signatureName, asm, parentItem); } }