public static (ASTNode node, string text) DecompileExport(ExportEntry export, FileLib lib = null) { try { ASTNode astNode = null; switch (export.ClassName) { case "Class": astNode = ME3ObjectToASTConverter.ConvertClass(export.GetBinaryData <UClass>(), true, lib); break; case "Function": astNode = ME3ObjectToASTConverter.ConvertFunction(export.GetBinaryData <UFunction>(), lib: lib); break; case "State": astNode = ME3ObjectToASTConverter.ConvertState(export.GetBinaryData <UState>(), lib: lib); break; case "Enum": astNode = ME3ObjectToASTConverter.ConvertEnum(export.GetBinaryData <UEnum>()); break; case "ScriptStruct": astNode = ME3ObjectToASTConverter.ConvertStruct(export.GetBinaryData <UScriptStruct>()); break; default: if (export.ClassName.EndsWith("Property") && ObjectBinary.From(export) is UProperty uProp) { astNode = ME3ObjectToASTConverter.ConvertVariable(uProp); } else { astNode = ME3ObjectToASTConverter.ConvertDefaultProperties(export); } break; } if (astNode != null) { var codeBuilder = new CodeBuilderVisitor(); astNode.AcceptVisitor(codeBuilder); return(astNode, codeBuilder.GetCodeString()); } } catch (Exception e) when(!App.IsDebug) { return(null, $"Error occured while decompiling {export?.InstancedFullPath}:\n\n{e.FlattenException()}"); } return(null, "Could not decompile!"); }