- Messages
- 10
- Country

Hi!
I've been able to get information from the airport with my C# program using AddTofacilityDefinition with no problems, but i'm now trying to get runway data and i'm having some issues. I'm just trying to get the runway heading for testing.
I'm using the following definitions to get the data:
Then to get the data i use:
The struct for runway data is the following:
This exact same method worked flawlessly when trying to get airport data, but with runway data it throws a cast exception ocurring inside OnRecvFacilityData before spitting out two correct heading values (in an airport that has 4 runways).
I'm not sure what am i doing wrong, it sounds to me like there's something wrong with the formatting of the output data. I've tried lots of stuff without better results.
Any ideas?
Thanks!
I've been able to get information from the airport with my C# program using AddTofacilityDefinition with no problems, but i'm now trying to get runway data and i'm having some issues. I'm just trying to get the runway heading for testing.
I'm using the following definitions to get the data:
C#:
_simConnection.AddToFacilityDefinition(DefineID, "OPEN AIRPORT");_simConnection.AddToFacilityDefinition(DefineID, "OPEN RUNWAY");
_simConnection.AddToFacilityDefinition(DefineID, "HEADING");
_simConnection.AddToFacilityDefinition(DefineID, "CLOSE RUNWAY");
_simConnection.AddToFacilityDefinition(DefineID, "CLOSE AIRPORT");
_simConnection.RegisterFacilityDataDefineStruct<runway>(SIMCONNECT_FACILITY_DATA_TYPE.RUNWAY);
_simConnection.RequestFacilityData(DefineID, RequestID, "SCEL", "");
C#:
private void simconnect_Facility_OnRecvFacilityData(SimConnect sender, SIMCONNECT_RECV_FACILITY_DATA data)
{
try
{
runway a = (runway)data.Data[0];
}
catch (Exception ex)
{
VoiceAttackPlugin.LogErrorOutput("OnRecvFacilityData problem with RUNWAY type. " + ex, "red");
}
}
The struct for runway data is the following:
C#:
struct runway
{
public System.Single heading1; //(using "float" instead results in the same problem)
}
This exact same method worked flawlessly when trying to get airport data, but with runway data it throws a cast exception ocurring inside OnRecvFacilityData before spitting out two correct heading values (in an airport that has 4 runways).
I'm not sure what am i doing wrong, it sounds to me like there's something wrong with the formatting of the output data. I've tried lots of stuff without better results.
Any ideas?
Thanks!

