private IEnumerable<ClassifiedArgument> ParseSequentialArguments(WholeArgumentStore result, IEnumerable<ClassifiedArgument> arguments) { var parameterEnumerator = this.CommandClassInfo.MainCommand.Parameters.GetEnumerator(); var argumentEnumerator = arguments.GetEnumerator(); while (parameterEnumerator.MoveNext() && argumentEnumerator.MoveNext()) { var parameterInfo = parameterEnumerator.Current; var argument = argumentEnumerator.Current; if (argument.ArgumentType == ArgumentType.Value) { result.StoreValue(parameterInfo, argument.Value); } else { throw new UnknownOptionException("Unknown option: " + argument.Value); } if (parameterInfo.IsMultiValued) { while (argumentEnumerator.MoveNext()) { result.StoreValue(parameterInfo, argumentEnumerator.Current.Value); } } } while (argumentEnumerator.MoveNext()) { yield return argumentEnumerator.Current; } }
private IEnumerable<ClassifiedArgument> ParseKeywordArguments(WholeArgumentStore result, IEnumerable<ClassifiedArgument> arguments) { var enumerator = arguments.GetEnumerator(); while (enumerator.MoveNext()) { var keywordOption = enumerator.Current; if (keywordOption.ArgumentType == ArgumentType.Keyword) { if (enumerator.MoveNext()) { var value = enumerator.Current; if (value.ArgumentType == ArgumentType.Value) { result.StoreValue(keywordOption.ParameterInfo, value.Value); } else { throw new LackKeywordArgumentValueException("lack value after: " + keywordOption); } } else { throw new LackKeywordArgumentValueException("lack value after: " + keywordOption); } } else { yield return keywordOption; } } }