/// <exception cref="BadSyntaxException">
		/// The <paramref name="declaration"/> does not fit to the syntax.
		/// </exception>
		/// <exception cref="ReservedNameException">
		/// The parameter name is already exists.
		/// </exception>
		public override Parameter ModifyParameter(Parameter parameter, string declaration)
		{
			Match match = singleParamterRegex.Match(declaration);
			int index = InnerList.IndexOf(parameter);

			if (index < 0)
				return parameter;

			if (match.Success)
			{
				Group nameGroup = match.Groups["name"];
				Group typeGroup = match.Groups["type"];
				Group modifierGroup = match.Groups["modifier"];
				Group defvalGroup = match.Groups["defval"];

				if (IsReservedName(nameGroup.Value, index))
					throw new ReservedNameException(nameGroup.Value);

				Parameter newParameter = new CSharpParameter(nameGroup.Value, typeGroup.Value,
					ParseParameterModifier(modifierGroup.Value), defvalGroup.Value);
				InnerList[index] = newParameter;
				return newParameter;
			}
			else
			{
				throw new BadSyntaxException(
					Strings.ErrorInvalidParameterDeclaration);
			}
		}
Esempio n. 2
0
		public void RemoveParameter(Parameter parameter)
		{
			argumentList.Remove(parameter);
			Changed();
		}
Esempio n. 3
0
		private void DrawItem(IGraphics g, Parameter parameter, Rectangle record, Style style)
		{
			Font font = GetFont(style);
			string memberString = parameter.ToString();
			parameterBrush.Color = style.EnumItemColor;

			if (style.UseIcons)
			{
				Image icon = Properties.Resources.Parameter;
				g.DrawImage(icon, record.X, record.Y);

				Rectangle textBounds = new Rectangle(
					record.X + IconSpacing, record.Y,
					record.Width - IconSpacing, record.Height);

				g.DrawString(memberString, font, parameterBrush, textBounds, memberFormat);
			}
			else
			{
				g.DrawString(memberString, font, parameterBrush, record, memberFormat);
			}
		}
Esempio n. 4
0
		/// <exception cref="BadSyntaxException">
		/// The name does not fit to the syntax.
		/// </exception>
		/// <exception cref="ReservedNameException">
		/// The parameter name is already exists.
		/// </exception>
		public Parameter ModifyParameter(Parameter parameter, string declaration)
		{
			Parameter modified = argumentList.ModifyParameter(parameter, declaration);

			Changed();
			return modified;
		}