-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
54 lines (44 loc) · 1.06 KB
/
Copy pathProgram.cs
File metadata and controls
54 lines (44 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using Glean;
if (args.Length != 1)
{
Console.Error.WriteLine("Usage: dotnet run --project samples/FastTraversalSample -- <assembly-path>");
return 1;
}
using var scope = AssemblyScope.Open(args[0]);
var assembly = scope.Context;
Console.WriteLine($"Assembly: {assembly.Name} {assembly.Version}");
Console.WriteLine($"Type rows: {scope.Reader.TypeDefinitions.Count}");
Console.WriteLine();
int printedTypes = 0;
foreach (var type in assembly.EnumerateTypes())
{
if (type.IsNested || !type.IsPublic)
{
continue;
}
Console.WriteLine(type.FullName);
int printedMethods = 0;
foreach (var method in type.EnumerateMethods())
{
if (!method.IsPublic || method.IsConstructor)
{
continue;
}
Console.WriteLine($" {method.Name}");
printedMethods++;
if (printedMethods == 5)
{
break;
}
}
printedTypes++;
if (printedTypes == 10)
{
break;
}
}
if (printedTypes == 0)
{
Console.WriteLine("<no public top level types>");
}
return 0;