Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Cmd.Net.FlagAttribute" /> class using the specified flag name.
        /// </summary>
        /// <param name="name">The name for an argument.</param>
        /// <exception cref="T:System.ArgumentException"><paramref name="name" /> contains one or more invalid characters.</exception>
        /// <remarks>
        /// A <paramref name="name" /> can be null, an empty string (""), or can contain letters, digits and underscore characters.
        /// </remarks>
        public FlagAttribute(char name)
        {
            name = char.ToUpperInvariant(name);
            CommandHelpers.ValidateFlagName("name", name);

            this.name = name;
        }
Exemplo n.º 2
0
        private ulong GetEnumValue(char flagName)
        {
            flagName = char.ToUpperInvariant(flagName);
            CommandHelpers.ValidateFlagName("flagName", flagName);

            for (int i = 0; i < _flagNamesAndValues.Length; i++)
            {
                if (_flagNamesAndValues[i].Key == flagName)
                {
                    return(_flagNamesAndValues[i].Value);
                }
            }

            throw new ArgumentException("flagName");
        }