RenCloud / scs-sdk-plugin

ETS2 (Euro Truck Simulator 2) & ATS (American Truck Simulator) SDK plug-in. Telemetry data is shared via SharedMemory/Memory Mapped Files.
MIT License
191 stars 38 forks source link

Enum AuxLevel #95

Closed TrucksLOG closed 2 years ago

TrucksLOG commented 2 years ago

Could someone help me with Enums? I would like to read out the AuxLevel? How do you do that? Never worked with enums before

RenCloud commented 2 years ago

Enums are kinda like readable numbers or flags, however, in C# you would need to convert to an int if you want to use it as a number.

So for the AuxLevel you could compare the value of the Telemetry with AuxLevel.Off to check if it is deactivated. Another way would be to convert the enum value with an int-cast and check if it is 0, 1 or 2.

Some UI Form objects have Enum handling, so far I know. For this, you would need to check the documentation.

However, this is not project related and a more general language question, so I will close this issue.