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); }
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; }
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); }
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); } }
/// <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; }
/// <summary> /// Initializes a new instance of the <see cref="CommandLine.CommandLineParser"/> class. /// </summary> public CommandLineParser() { _settings = new CommandLineParserSettings(); }