public static API Parse(string filename) { var assembly = Assembly.LoadFile(filename); var ret = new API(); foreach (var exportedType in assembly.GetExportedTypes()) { if (!IsBindingEntity(exportedType)) { continue; } switch (GetEntityKind(exportedType)) { case EntityKind.Class: ret.Classes.Add(Class.From(exportedType)); break; case EntityKind.Enum: ret.Enums.Add(Enum.From(exportedType)); break; case EntityKind.Function: ret.FunctionPointers.Add(Function.From(exportedType)); break; case EntityKind.Struct: ret.Structs.Add(Struct.From(exportedType)); break; default: throw new ArgumentException($"Failed to get entity Type of type {exportedType.FullName}"); } } return(ret); }