private string GetUnit(FieldInfo fieldInfo, SimVarAttribute attr) { if (attr != null && attr.UnitId != FsUnit.Undefined) { return(FsUnitFactory.GetUnitName(attr.UnitId)); } if (!string.IsNullOrEmpty(attr?.Unit)) { return(attr.Unit); } return(""); }
/// <summary> /// Creates an initialized instance using enums for known values. /// </summary> /// <param name="simVarId"></param> /// <param name="unitId"></param> /// <param name="dataType"></param> public SimVar(FsSimVar simVarId, FsUnit unitId, SIMCONNECT_DATATYPE dataType) { Name = FsSimVarFactory.GetSimVarName(simVarId); Unit = FsUnitFactory.GetUnitName(unitId); DataType = dataType; }
/// <summary> /// Creates an initialized instance of the <see cref="SimVar"/> class. /// </summary> /// <param name="simVarName"></param> /// <param name="unitId"></param> /// <param name="dataType"></param> public SimVar(string simVarName, FsUnit unitId, SIMCONNECT_DATATYPE dataType) { Name = simVarName; Unit = FsUnitFactory.GetUnitName(unitId); DataType = dataType; }
/// <summary> /// Creates an initialized instance using enums for known values. /// </summary> /// <param name="simVar"></param> /// <param name="unit"></param> /// <param name="dataType"></param> public SimProperty(FsSimVar simVar, FsUnit unit, SIMCONNECT_DATATYPE dataType) { Name = FsSimVarFactory.GetSimVarCode(simVar); Unit = FsUnitFactory.GetUnitName(unit); DataType = dataType; }