예제 #1
0
 /// <summary>
 /// The add.
 /// </summary>
 /// <param name="parameter">
 /// The parameter.
 /// </param>
 /// <exception cref="CommandLineException">
 /// </exception>
 private void Add(CommandLineParameter parameter)
 {
     // Each attribute is uniquely keyed
     try
     {
         this.Parameters.Add(parameter.Key, parameter);
     }
     catch (ArgumentException exception)
     {
         throw new CommandLineException(
                   new CommandArgumentHelp(
                       parameter.Property.DeclaringType,
                       parameter.IsCommand()
           ? string.Format("Duplicate Command \"{0}\"", parameter.Command)
           : string.Format(
                           "Duplicate Parameter Index [{0}] on Property \"{1}\"", parameter.Attribute.ParameterIndex, parameter.Property.Name)),
                   exception);
     }
 }
 internal void Validate(CommandLineParameter parameter)
 {
     if (ParameterIndex < 1)
     {
         throw new CommandLineException(
             new CommandArgumentHelp(parameter.Property, Strings.InvalidPropertyParameterIndexValue(parameter.Property.Name)));
     }
 }
 /// <summary>
 /// The validate.
 /// </summary>
 /// <param name="parameter">
 /// The parameter.
 /// </param>
 /// <exception cref="CommandLineException">
 /// </exception>
 internal void Validate(CommandLineParameter parameter)
 {
     if (this.ParameterIndex < 1)
     {
         throw new CommandLineException(
             new CommandArgumentHelp(parameter.Property, string.Format("Invalid ParameterNumber value on Property \"{0}\"", parameter.Property.Name)));
     }
 }
예제 #4
0
 private static int ParameterIndex(CommandLineParameter parameter)
 {
     return(parameter.Attribute.ParameterIndex);
 }
예제 #5
0
 private static bool IsParameter(CommandLineParameter parameter)
 {
     return(parameter.IsParameter());
 }