Skip to content

Commit

Permalink
Update Exporter.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfcomp authored Jan 24, 2025
1 parent 7bdad77 commit 7162722
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CExporter/Exporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ private static ProcessedField ProcessField(FieldInfo field, int offset) {
if (vtable != null) {
vtable = vtable.GetElementType()!;
var memberFunctions = type.GetMethods(ExporterStatics.BindingFlags).Where(t => t.GetCustomAttribute<VirtualFunctionAttribute>() != null).Select(t => new { Name = t.Name, Parameters = t.GetParameters(), ReturnType = t.ReturnType }).ToArray();
virtualFunctions = vtable.GetFields(ExporterStatics.BindingFlags).Select(f => {
virtualFunctions = vtable.GetFields(ExporterStatics.BindingFlags).Where(t => t.GetCustomAttribute<ObsoleteAttribute>() == null && t.GetCustomAttribute<CExportIgnoreAttribute>() == null && t.GetCustomAttribute<CExporterUnionAttribute>() != null).Select(f => {
var memberFunction = memberFunctions.FirstOrDefault(t => t.Name == f.Name);
var returnType = f.FieldType.GetFunctionPointerReturnType();
if (memberFunction?.ReturnType != returnType) memberFunction = null;
Expand All @@ -415,7 +415,7 @@ private static ProcessedField ProcessField(FieldInfo field, int offset) {
var memberFunctionClass = type.GetMember("MemberFunctionPointers", ExporterStatics.BindingFlags).FirstOrDefault()?.DeclaringType;
ProcessedMemberFunction[] memberFunctionsArray = [];
if (memberFunctionClass != null) {
var memberFunctions = memberFunctionClass.GetMethods(ExporterStatics.BindingFlags);
var memberFunctions = memberFunctionClass.GetMethods(ExporterStatics.BindingFlags).Where(t => t.GetCustomAttribute<ObsoleteAttribute>() == null && t.GetCustomAttribute<CExportIgnoreAttribute>() == null).ToArray();
foreach (var memberFunction in memberFunctions) {
var memberFunctionAddress = memberFunction.GetCustomAttribute<MemberFunctionAttribute>();
if (memberFunctionAddress == null) continue;
Expand Down Expand Up @@ -450,7 +450,7 @@ .. memberFunctionParameters.Select(p => {
}

var fields = type.GetFields(ExporterStatics.BindingFlags).Where(t => !type.IsInheritance(t)).ToArray();
var unionFields = fields.Where(t => t.GetCustomAttribute<ObsoleteAttribute>() == null && t.GetCustomAttribute<CExportIgnoreAttribute>() == null && t.GetCustomAttribute<CExporterUnionAttribute>() != null).ToArray();
var unionFields = fields.Where(t => t.GetCustomAttribute<ObsoleteAttribute>() == null && t.GetCustomAttribute<CExportIgnoreAttribute>() == null).ToArray();

var unionOffsets = new Dictionary<CExporterUnionAttribute, FieldInfo>(new CExporterUnionCompare());

Expand Down

0 comments on commit 7162722

Please sign in to comment.