C# Receiving CustomMissionAction

Discuss on the SimConnect SDK can be used by programmers to write add-on components for Prepar3D
Locked
Hegyusz
Posts: 1
Joined: Tue Feb 20, 2018 12:12 pm

C# Receiving CustomMissionAction

Post by Hegyusz »

Hello,

Does anybody know how can I properly receive Custom Mission Actions in C# with simconnect?

The following C# code seems to be working, but I can only get the first letter of the szPayLoad...
simconnect.OnRecvCustomAction += new SimConnect.RecvCustomActionEventHandler(simconnect_OnRecvEvent);
simconnect.SubscribeToSystemEvent(EVENTS.CUSTOM, "CustomMissionActionExecuted");

private void simconnect_OnRecvCustomAction(SimConnect sender, SIMCONNECT_RECV_CUSTOM_ACTION recAction)
{
// recAction.szPayLoad
}
I realised, that the SIMCONNECT_RECV_CUSTOM_ACTION class (from the DLL) looks like this:
public class SIMCONNECT_RECV_CUSTOM_ACTION : SIMCONNECT_RECV_EVENT_BASE
{
public uint dwWaitForCompletion;

public Guid guidInstanceId;
[VariableSize]
public string szPayLoad;

public SIMCONNECT_RECV_CUSTOM_ACTION();
}
... and the variable size attribute (from the DLL):
public class VariableSizeAttribute : Attribute
{
public VariableSizeAttribute();
public string CountMember { get; set; }
public Type FixedType { get; set; }
public string TypeMember { get; set; }
}
Can anybody help me, how can I set this VariableSize attribute, or what's the problem with my code?

Thanks.
Locked