private string ProduceModuleInfo(ClrModule module) { var sb = new StringBuilder(); sb.AppendLine($"Module name: {(module.Name ?? "[NoModuleName]")}"); sb.AppendLine($"Address: {module.MetadataAddress}"); sb.AppendLine("Types read from module:"); var intend = '\t'; int number = 1; foreach (var type in module.EnumerateTypes()) { sb.AppendLine($"{intend}{number} Name: {type.Name ?? "[NoTypeName]"}"); sb.AppendLine($"{intend}{intend} IsInternal: {type.IsInternal}"); sb.AppendLine($"{intend}{intend} IsPublic: {type.IsPublic}"); number += 1; sb.AppendLine($"{intend}{intend} Methods:"); foreach (var method in type.Methods) { sb.AppendLine($"{intend}{intend}{intend}{method.GetFullSignature() ?? "[NoSignature]"}"); } sb.AppendLine($"{intend}{intend} Fields:"); foreach (var field in type.Fields) { sb.AppendLine($"{intend}{intend}{intend}{field.Name ?? "[Name]"}"); } sb.AppendLine("***************"); } return(sb.ToString()); }
private static ExplorerItem BuildModuleExplorerItem(ClrModule module, HashSet <ClrType> types) { var name = string.IsNullOrEmpty(module.Name) ? "(noname)" : module.Name; var item = new ExplorerItem(name, ExplorerItemKind.Category, ExplorerIcon.OneToMany) { ToolTipText = $"{module.Name} ({module.AssemblyName})", Children = new List <ExplorerItem>() }; foreach (var type in module.EnumerateTypes().Where(types.Contains)) { item.Children.Add(BuildExplorerItem(type)); } return(item); }
/// <summary> /// Enumerate all types defined by this module. /// </summary> /// <returns>IEnumerable<IClrType>.</returns> /// <exception cref="NotImplementedException"></exception> /// <inheritdoc /> public IEnumerable <IClrType> EnumerateTypes() => Module.EnumerateTypes().Select(Converter.Convert);