Example #1
0
        public static OptionMap CreateMap(object target, CommandLineParserSettings settings)
        {
            var       list = ReflectionUtil.RetrieveFieldList <OptionAttribute>(target);
            OptionMap map  = new OptionMap(list.Count, settings);

            foreach (Pair <FieldInfo, OptionAttribute> pair in list)
            {
                map[pair.Right.UniqueName] = new OptionInfo(pair.Right, pair.Left);
            }

            return(map);
        }
Example #2
0
        public static OptionMap CreateMap(object target, CommandLineParserSettings settings)
        {
            var list = ReflectionUtil.RetrieveFieldList<OptionAttribute>(target);
            OptionMap map = new OptionMap(list.Count, settings);

            foreach (Pair<FieldInfo, OptionAttribute> pair in list)
            {
                map[pair.Right.UniqueName] = new OptionInfo(pair.Right, pair.Left);
            }

            return map;
        }
Example #3
0
        public OptionMap(int capacity, CommandLineParserSettings settings)
        {
            _settings = settings;

            IEqualityComparer<string> comparer;
            if (_settings.CaseSensitive)
                comparer = StringComparer.Ordinal;
            else
                comparer = StringComparer.OrdinalIgnoreCase;

            _names = new Dictionary<string, string>(capacity, comparer);
            _map = new Dictionary<string, OptionInfo>(capacity * 2, comparer);

            if (_settings.MutuallyExclusive)
                _mutuallyExclusiveSetMap = new Dictionary<string, int>(capacity, StringComparer.OrdinalIgnoreCase);
        }
Example #4
0
        public OptionMap(int capacity, CommandLineParserSettings settings)
        {
            _settings = settings;

            IEqualityComparer <string> comparer;

            if (_settings.CaseSensitive)
            {
                comparer = StringComparer.Ordinal;
            }
            else
            {
                comparer = StringComparer.OrdinalIgnoreCase;
            }

            _names = new Dictionary <string, string>(capacity, comparer);
            _map   = new Dictionary <string, OptionInfo>(capacity * 2, comparer);

            if (_settings.MutuallyExclusive)
            {
                _mutuallyExclusiveSetMap = new Dictionary <string, int>(capacity, StringComparer.OrdinalIgnoreCase);
            }
        }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CommandLine.CommandLineParser"/> class,
        /// configurable with a <see cref="CommandLine.CommandLineParserSettings"/> object.
        /// </summary>
        /// <param name="settings">The <see cref="CommandLine.CommandLineParserSettings"/> object is used to configure
        /// aspects and behaviors of the parser.</param>
        public CommandLineParser(CommandLineParserSettings settings)
        {
            Assumes.NotNull(settings, "settings");

            _settings = settings;
        }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandLine.CommandLineParser"/> class.
 /// </summary>
 public CommandLineParser()
 {
     _settings = new CommandLineParserSettings();
 }
Example #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CommandLine.CommandLineParser"/> class,
        /// configurable with a <see cref="CommandLine.CommandLineParserSettings"/> object.
        /// </summary>
        /// <param name="settings">The <see cref="CommandLine.CommandLineParserSettings"/> object is used to configure
        /// aspects and behaviors of the parser.</param>
        public CommandLineParser(CommandLineParserSettings settings)
        {
            Assumes.NotNull(settings, "settings");

            _settings = settings;
        }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandLine.CommandLineParser"/> class.
 /// </summary>
 public CommandLineParser()
 {
     _settings = new CommandLineParserSettings();
 }