Пример #1
0
        private static void ParseOverrideConfig(Arguments arguments, string[] values)
        {
            if (values == null || values.Length == 0)
            {
                return;
            }

            var parser = new OverrideConfigOptionParser();

            // key=value
            foreach (var keyValueOption in values)
            {
                var keyAndValue = QuotedStringHelpers.SplitUnquoted(keyValueOption, '=');
                if (keyAndValue.Length != 2)
                {
                    throw new WarningException($"Could not parse /overrideconfig option: {keyValueOption}. Ensure it is in format 'key=value'.");
                }

                var optionKey = keyAndValue[0].ToLowerInvariant();
                if (!parser.SupportedProperties.Contains(optionKey))
                {
                    throw new WarningException($"Could not parse /overrideconfig option: {keyValueOption}. Unsuported 'key'.");
                }
                else
                {
                    parser.SetValue(optionKey, keyAndValue[1]);
                }
            }
            arguments.OverrideConfig = parser.GetConfig();
        }
Пример #2
0
        public Arguments ParseArguments(string commandLineArguments)
        {
            var arguments = QuotedStringHelpers.SplitUnquoted(commandLineArguments, ' ');

            return(ParseArguments(arguments));
        }