Dragonlaird / SimConnectHelper

A static class to simplify communication with MSFS 2020 using SimConnect.
28 stars 7 forks source link

parsing enum with .net 4.x #8

Open Sedowan opened 2 years ago

Sedowan commented 2 years ago

Dear Dragonlaird,

Thank you for creating this project. While porting the project to my .net 4.x application if stumbled upon an issue parsing the frequency in the SimConnectHelper class (line 716).

SIMCONNECT_PERIOD period = Enum.Parse<SIMCONNECT_PERIOD>(frequency.ToString().ToUpper());

Since the .Parse function has changed, I would like to suggest following fix:

SIMCONNECT_PERIOD period = (SIMCONNECT_PERIOD)Enum.Parse(typeof(SimConnectUpdateFrequency), frequency.ToString().ToUpper());

I hope that helps.

Kind Regards, Sedowan

Dragonlaird commented 2 years ago

Thanks for the feedback. This is a common problem it seems but easily fixed, I've not updated the code yet due to lack of time but the fix is to replace the offending line with:

image

Sedowan commented 2 years ago

Thank you, even more convenient.