private int GetPosition(PropertyCache property, bool isNameParameter, NewSensorAttribute parameterConfig, int?position) { if (isNameParameter) { if (parameterConfig.DynamicName) { return(int.MinValue); } return(1); } if (property.GetAttribute <RequireValueAttribute>()?.ValueRequired == true) { //If we have an invoker, don't give positions to required values in case the type of parameter //at this position conflicts with the parameter that might be used in the cmdlet parameter set if (makeCmdlet != null) { return(int.MinValue); } if (parameterConfig.DynamicName) { if (position == null) { position = 1; //Set it to the first position after the SensorType SwitchParameter } else { position++; } } else { if (position == null) { position = 2; //Set it to be the first position after the SensorType SwitchParameter and Name } else { position++; } } return(position.Value); } return(int.MinValue); }
private bool GetMandatory(PropertyCache property, bool isNameParameter, NewSensorAttribute parameterConfig) { if (parameterConfig.ConfigOptional) { return(false); } if (isNameParameter) { if (parameterConfig.DynamicName) { return(false); } return(true); } return(HasRequireValueTrue(property)); }