/// <summary> /// Initializes a new IllegalOptionValueException. /// </summary> /// <param name="option">The option with an invalid or missing value.</param> /// <param name="value">The invalid value supplied by the user.</param> public IllegalOptionValueException( Option option, string value ) : base("Illegal value '" + value + "' for option " + "--" + option.LongForm) { this._option = option; this._value = value; }
//private Hashtable _values = new Hashtable(10); /// <summary> /// Add the given Option to the list of accepted options. /// </summary> /// <param name="option">The option to add.</param> /// <returns>Returns the option after adding it.</returns> /// <exception cref="NArgs.DuplicateOptionException">The short form /// is not unique.</exception> /// <exception cref="NArgs.DuplicateOptionException">The long form /// is not unique.</exception> /// <remarks>Every option added to a CmdLineParser must have a unique long form. Every /// option with a non-null or non-empty short form, must have a unique short form. /// The <c>Message</c> property contains an error string suitable for reporting the error /// to the user (in English).</remarks> public Option AddOption( Option option ) { string shortForm = option.ShortForm; string fullShortForm = "-" + shortForm; string longForm = option.LongForm; string fullLongForm = "--" + longForm; #region Validate Parameters if(null != shortForm && string.Empty != shortForm) if(this._options.ContainsKey(fullShortForm)) throw new DuplicateOptionException(shortForm); if(this._options.ContainsKey(fullLongForm)) throw new DuplicateOptionException(longForm); #endregion if(null != shortForm && string.Empty != shortForm) this._options.Add(fullShortForm, option); this._options.Add(fullLongForm, option); return option; }