private VariableKeyInConfig getKeyInConfig(string controlStr) { VariableKeyInConfig key = new VariableKeyInConfig(); key.Name = controlStr; key.MaxValueKey = "max_" + controlStr; key.MinValueKey = "min_" + controlStr; key.FGMinValeKey = "fg_max_" + controlStr; key.FGMaxValueKey = "fg_min_" + controlStr; return(key); }
private void setVariables() { VariableKeyInConfig aileronKey = getKeyInConfig("aileron"); VariableKeyInConfig elevatorKey = getKeyInConfig("elevator"); VariableKeyInConfig rudderKey = getKeyInConfig("rudder"); VariableKeyInConfig flapsKey = getKeyInConfig("flaps"); VariableKeyInConfig throttleKey = getKeyInConfig("throttle"); aileron = new Variable(properties.get(aileronKey.Name), properties.getFloat(aileronKey.MinValueKey), properties.getFloat(aileronKey.MaxValueKey), properties.getFloat(aileronKey.FGMinValeKey), properties.getFloat(aileronKey.FGMaxValueKey)); elevator = new Variable(properties.get(elevatorKey.Name), properties.getFloat(elevatorKey.MinValueKey), properties.getFloat(elevatorKey.MaxValueKey), properties.getFloat(elevatorKey.FGMinValeKey), properties.getFloat(elevatorKey.FGMaxValueKey)); rudder = new Variable(properties.get(rudderKey.Name), properties.getFloat(rudderKey.MinValueKey), properties.getFloat(rudderKey.MaxValueKey), properties.getFloat(rudderKey.FGMinValeKey), properties.getFloat(rudderKey.FGMaxValueKey)); flaps = new Variable(properties.get(flapsKey.Name), properties.getFloat(flapsKey.MinValueKey), properties.getFloat(flapsKey.MaxValueKey), properties.getFloat(flapsKey.FGMinValeKey), properties.getFloat(flapsKey.FGMaxValueKey)); throttle = new Variable(properties.get(throttleKey.Name), properties.getFloat(throttleKey.MinValueKey), properties.getFloat(throttleKey.MaxValueKey), properties.getFloat(throttleKey.FGMinValeKey), properties.getFloat(throttleKey.FGMaxValueKey)); }