public static void setValue <T>(string paramName, string paramValue) { lock (lockParameters) { // retrieve the parameter iParam param = getParameter(paramName); // create the parameter if it does not exist if (param == null) { param = addParameter <T>(paramName); } // if not able to create, return if (param == null) { return; } // call setter of the parameter for further processing if (param.setValue(paramValue)) { // successfully set // also store certain types as evaluable variables if (param.GetType() == typeof(ParamBool)) { evaluableVariables[paramName] = ((ParamBool)param).Value ? 1 : 0; } else if (param.GetType() == typeof(ParamInt)) { evaluableVariables[paramName] = ((ParamInt)param).Value; } else if (param.GetType() == typeof(ParamDouble)) { evaluableVariables[paramName] = ((ParamDouble)param).Value; } } else { // failure to set // message logger.Error("Could not find parameter '" + paramName + "' in globals, discarded"); } } }
public bool setValue(string paramName, string paramValue) { lock (lockParameters) { iParam param = getParameter(paramName); if (param == null) { logger.Error("Could not find parameter '" + paramName + "' in parameter set '" + paramSetName + "', value not set"); return(false); } // call setter of the parameter for further processing if (!param.setValue(paramValue)) { return(false); } // return success return(true); } }