Exemplo n.º 1
0
        /// <summary>
        /// Adds a new argument.
        /// </summary>
        /// <param name="name">The argument name.</param>
        /// <param name="description">The argument description.</param>
        /// <param name="types">The argument types.</param>
        /// <returns>
        /// The <see cref="CommandLineArgument"/> object this method creates.
        /// </returns>
        public CommandLineArgument AddArgument(string name, string description, CommandLineArgumentTypes types)
        {
            CommandLineArgument argument = new CommandLineArgument(name, description, types);

            this.arguments.Add(argument);
            return(argument);
        }
Exemplo n.º 2
0
        public CommandLineArgument(CommandLineArgumentAttribute attribute, PropertyInfo propertyInfo)
        {
            _attribute = attribute;
            _propertyInfo = propertyInfo;
            _seenValue = false;

            _elementType = GetElementType(propertyInfo);
            _argumentType = GetArgumentType(attribute, propertyInfo);

            if (IsCollection || IsArray) {
                _collectionValues = new ArrayList();
            } else if (IsNameValueCollection) {
                _valuePairs = new NameValueCollection();
            }

            Debug.Assert(LongName != null && LongName.Length > 0);
            Debug.Assert((!IsCollection && !IsArray && !IsNameValueCollection) || AllowMultiple, "Collection and array arguments must have allow multiple");
            Debug.Assert(!Unique || (IsCollection || IsArray || IsNameValueCollection), "Unique only applicable to collection arguments");
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandLineArgumentAttribute" /> class
 /// with the specified argument type.
 /// </summary>
 /// <param name="argumentType">Specifies the checking to be done on the argument.</param>
 public CommandLineArgumentAttribute(CommandLineArgumentTypes argumentType)
 {
     _argumentType = argumentType;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandLineArgumentAttribute" /> class
 /// with the specified argument type.
 /// </summary>
 /// <param name="argumentType">Specifies the checking to be done on the argument.</param>
 public DefaultCommandLineArgumentAttribute(CommandLineArgumentTypes argumentType) : base(argumentType)
 {
 }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandLineArgumentAttribute" /> class
 /// with the specified argument type.
 /// </summary>
 /// <param name="argumentType">Specifies the checking to be done on the argument.</param>
 public CommandLineArgumentAttribute(CommandLineArgumentTypes argumentType) {
     _argumentType = argumentType;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandLineArgumentAttribute" /> class
 /// with the specified argument type.
 /// </summary>
 /// <param name="argumentType">Specifies the checking to be done on the argument.</param>
 public DefaultCommandLineArgumentAttribute(CommandLineArgumentTypes argumentType)
     : base(argumentType)
 {
 }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandLineArgument"/> class.
 /// </summary>
 /// <param name="name">The argument name.</param>
 /// <param name="description">The argument description.</param>
 /// <param name="types">The argument types.</param>
 public CommandLineArgument(string name, string description, CommandLineArgumentTypes types)
 {
     this.Name        = name;
     this.Description = description;
     this.Types       = types;
 }