/// <summary> /// Adds the elements of a <see cref="CommandLineArgumentCollection"/> to the end of the collection. /// </summary> /// <param name="items">The <see cref="CommandLineArgumentCollection"/> to be added to the end of the collection.</param> public void AddRange(CommandLineArgumentCollection items) { for (int i = 0; (i < items.Count); i = (i + 1)) { Add(items[i]); } }
/// <summary> /// Initializes a new instance of the <see cref="CommandLineParser" /> class /// using possible arguments deducted from the specific <see cref="Type" />. /// </summary> /// <param name="argumentSpecification">The <see cref="Type" /> from which the possible command-line arguments should be retrieved.</param> /// <param name="supportsResponseFile">A <see cref="bool" /> value indicating whether or not a response file is able to be used. </param> /// <exception cref="ArgumentNullException"><paramref name="argumentSpecification" /> is a null reference.</exception> public CommandLineParser(Type argumentSpecification, bool supportsResponseFile) { if (argumentSpecification == null) { throw new ArgumentNullException("argumentSpecification"); } _argumentCollection = new CommandLineArgumentCollection(); foreach (PropertyInfo propertyInfo in argumentSpecification.GetProperties(BindingFlags.Instance | BindingFlags.Public)) { if (propertyInfo.CanWrite || typeof(ICollection).IsAssignableFrom(propertyInfo.PropertyType)) { CommandLineArgumentAttribute attribute = GetCommandLineAttribute(propertyInfo); if (attribute is DefaultCommandLineArgumentAttribute) { Debug.Assert(_defaultArgument == null); _defaultArgument = new CommandLineArgument(attribute, propertyInfo); } else if (attribute != null) { _argumentCollection.Add(new CommandLineArgument(attribute, propertyInfo)); } } } _argumentSpecification = argumentSpecification; _supportsResponseFile = supportsResponseFile; }
/// <summary> /// Initializes a new instance of the <see cref="CommandLineParser" /> class /// using possible arguments deducted from the specific <see cref="Type" />. /// </summary> /// <param name="argumentSpecification">The <see cref="Type" /> from which the possible command-line arguments should be retrieved.</param> /// <param name="supportsResponseFile">A <see cref="bool" /> value indicating whether or not a response file is able to be used. </param> /// <exception cref="ArgumentNullException"><paramref name="argumentSpecification" /> is a null reference.</exception> public CommandLineParser(Type argumentSpecification, bool supportsResponseFile ) { if (argumentSpecification == null) { throw new ArgumentNullException("argumentSpecification"); } _argumentCollection = new CommandLineArgumentCollection(); foreach (PropertyInfo propertyInfo in argumentSpecification.GetProperties(BindingFlags.Instance | BindingFlags.Public)) { if (propertyInfo.CanWrite || typeof(ICollection).IsAssignableFrom(propertyInfo.PropertyType)) { CommandLineArgumentAttribute attribute = GetCommandLineAttribute(propertyInfo); if (attribute is DefaultCommandLineArgumentAttribute) { Debug.Assert(_defaultArgument == null); _defaultArgument = new CommandLineArgument(attribute, propertyInfo); } else if (attribute != null) { _argumentCollection.Add(new CommandLineArgument(attribute, propertyInfo)); } } } _argumentSpecification = argumentSpecification; _supportsResponseFile = supportsResponseFile; }
/// <summary> /// Initializes a new instance of the <see cref="CommandLineArgumentCollection"/> class /// with the specified <see cref="CommandLineArgumentCollection"/> instance. /// </summary> public CommandLineArgumentCollection(CommandLineArgumentCollection value) { AddRange(value); }
/// <summary> /// Initializes a new instance of the <see cref="CommandLineArgumentEnumerator"/> class /// with the specified <see cref="CommandLineArgumentCollection"/>. /// </summary> /// <param name="arguments">The collection that should be enumerated.</param> internal CommandLineArgumentEnumerator(CommandLineArgumentCollection arguments) { IEnumerable temp = (IEnumerable)(arguments); _baseEnumerator = temp.GetEnumerator(); }
/// <summary> /// Initializes a new instance of the <see cref="CommandLineArgumentEnumerator"/> class /// with the specified <see cref="CommandLineArgumentCollection"/>. /// </summary> /// <param name="arguments">The collection that should be enumerated.</param> internal CommandLineArgumentEnumerator(CommandLineArgumentCollection arguments) { IEnumerable temp = (IEnumerable) (arguments); _baseEnumerator = temp.GetEnumerator(); }