public static Dictionary <DCVariablesEnum, float> SetDCList(SdkWrapper wrapper) { var dcVars = new Dictionary <DCVariablesEnum, float>(); if (wrapper.IsConnected) { foreach (object dcV in Enum.GetValues(typeof(DCVariablesEnum))) { try { var temp = (DCVariablesEnum)dcV; switch (temp) { case DCVariablesEnum.BrakeBias: if (wrapper.containsKey("dcBrakeBias")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.AntiRollFront: if (wrapper.containsKey("dcAntiRollFront")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.AntiRollRear: if (wrapper.containsKey("dcAntiRollRear")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.FuelMixture: if (wrapper.containsKey("dcFuelMixture")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.RevLimiter: if (wrapper.containsKey("dcRevLimiter")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.WeightJackerLeft: if (wrapper.containsKey("dcWeightJackerLeft")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.WeightJackerRight: if (wrapper.containsKey("dcWeightJackerRight")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.ABS: if (wrapper.containsKey("dcABS")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.TractionControl: if (wrapper.containsKey("dcTractionControl")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.TractionControl2: if (wrapper.containsKey("dcTractionControl2")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.WingFront: if (wrapper.containsKey("dcWingFront")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.WingRear: if (wrapper.containsKey("dcWingRear")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DiffEntry: if (wrapper.containsKey("dcDiffEntry")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DiffMiddle: if (wrapper.containsKey("dcDiffMiddle")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DiffExit: if (wrapper.containsKey("dcDiffExit")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.EngineBraking: if (wrapper.containsKey("dcEngineBraking")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.EnginePower: if (wrapper.containsKey("dcEnginePower")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.ThrottleShape: if (wrapper.containsKey("dcThrottleShape")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpFWingIndex: if (wrapper.containsKey("dpFWingIndex")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpRWingIndex: if (wrapper.containsKey("dpRWingIndex")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpRWingSetting: if (wrapper.containsKey("dpRWingSetting")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpWedgeAdj: if (wrapper.containsKey("dpWedgeAdj")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpPSSetting: if (wrapper.containsKey("dpPSSetting")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpRRDamperPerchOffsetm: if (wrapper.containsKey("dpRRDamperPerchOffsetm")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpRBarSetting: if (wrapper.containsKey("dpRBarSetting")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpRFTruckarmP1Dz: if (wrapper.containsKey("dpRFTruckarmP1Dz")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpTruckarmP1Dz: if (wrapper.containsKey("dpTruckarmP1Dz")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpQtape: if (wrapper.containsKey("dpQtape")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpFNOMKnobSetting: if (wrapper.containsKey("dpFNOMKnobSetting")) { dcVars.Add(temp, 0f); } break; default: throw new ArgumentOutOfRangeException(); } } // ReSharper disable EmptyGeneralCatchClause catch (Exception) // ReSharper restore EmptyGeneralCatchClause { //if exception is thrown then that var is not for this current car and ignore. } } } return(dcVars); }
public static Dictionary<DCVariablesEnum, float> SetDCList(SdkWrapper wrapper) { var dcVars = new Dictionary<DCVariablesEnum, float>(); if (wrapper.IsConnected) { foreach (object dcV in Enum.GetValues(typeof(DCVariablesEnum))) { try { var temp = (DCVariablesEnum)dcV; switch (temp) { case DCVariablesEnum.BrakeBias: if (wrapper.containsKey("dcBrakeBias")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.AntiRollFront: if (wrapper.containsKey("dcAntiRollFront")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.AntiRollRear: if (wrapper.containsKey("dcAntiRollRear")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.FuelMixture: if (wrapper.containsKey("dcFuelMixture")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.RevLimiter: if (wrapper.containsKey("dcRevLimiter")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.WeightJackerLeft: if (wrapper.containsKey("dcWeightJackerLeft")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.WeightJackerRight: if (wrapper.containsKey("dcWeightJackerRight")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.ABS: if (wrapper.containsKey("dcABS")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.TractionControl: if (wrapper.containsKey("dcTractionControl")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.TractionControl2: if (wrapper.containsKey("dcTractionControl2")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.WingFront: if (wrapper.containsKey("dcWingFront")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.WingRear: if (wrapper.containsKey("dcWingRear")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DiffEntry: if (wrapper.containsKey("dcDiffEntry")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DiffMiddle: if (wrapper.containsKey("dcDiffMiddle")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DiffExit: if (wrapper.containsKey("dcDiffExit")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.EngineBraking: if (wrapper.containsKey("dcEngineBraking")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.EnginePower: if (wrapper.containsKey("dcEnginePower")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.ThrottleShape: if (wrapper.containsKey("dcThrottleShape")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpFWingIndex: if (wrapper.containsKey("dpFWingIndex")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpRWingIndex: if (wrapper.containsKey("dpRWingIndex")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpRWingSetting: if (wrapper.containsKey("dpRWingSetting")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpWedgeAdj: if (wrapper.containsKey("dpWedgeAdj")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpPSSetting: if (wrapper.containsKey("dpPSSetting")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpRRDamperPerchOffsetm: if (wrapper.containsKey("dpRRDamperPerchOffsetm")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpRBarSetting: if (wrapper.containsKey("dpRBarSetting")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpRFTruckarmP1Dz: if (wrapper.containsKey("dpRFTruckarmP1Dz")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpTruckarmP1Dz: if (wrapper.containsKey("dpTruckarmP1Dz")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpQtape: if (wrapper.containsKey("dpQtape")) { dcVars.Add(temp, 0f); } break; case DCVariablesEnum.DpFNOMKnobSetting: if (wrapper.containsKey("dpFNOMKnobSetting")) { dcVars.Add(temp, 0f); } break; default: throw new ArgumentOutOfRangeException(); } } // ReSharper disable EmptyGeneralCatchClause catch (Exception) // ReSharper restore EmptyGeneralCatchClause { //if exception is thrown then that var is not for this current car and ignore. } } } return dcVars; }