public void RegisterConstant(string constantName, ExecutionResult value, bool isOverWritable) { if (string.IsNullOrEmpty(constantName)) { throw new ArgumentNullException("constantName"); } constantName = ConvertConstantName(constantName); if (constants.ContainsKey(constantName) && !constants[constantName].IsOverWritable) { string message = string.Format("The constant \"{0}\" cannot be overwriten.", constantName); throw new Exception(message); } ConstantInfo constantInfo = new ConstantInfo(constantName, value, isOverWritable); if (constants.ContainsKey(constantName)) { constants[constantName] = constantInfo; } else { constants.Add(constantName, constantInfo); } }
public ConstantInfo GetConstantInfo(string constantName) { if (string.IsNullOrEmpty(constantName)) { throw new ArgumentNullException("constantName"); } ConstantInfo constantInfo = null; return(constants.TryGetValue(ConvertConstantName(constantName), out constantInfo) ? constantInfo : null); }