private void SetAggregatedOptions(object commandObject, Queue <string> argQ, string options, string value) { var argsRequired = 0; options = options.Substring(1); foreach (var option in options) { var optionProperty = AssemblySearcher .GetCommandOptionPropertyByName( commandObject.GetType(), option.ToString()).First(); if (optionProperty.PropertyType == typeof(bool)) { optionProperty.SetValue(commandObject, true); } else if (optionProperty.PropertyType == typeof(string)) { optionProperty.SetValue(commandObject, value ?? argQ.Dequeue()); argsRequired++; } else if (_converterFuncs.ContainsKey(optionProperty.PropertyType)) { optionProperty.SetValue(commandObject, _converterFuncs[optionProperty.PropertyType](value ?? argQ.Dequeue())); argsRequired++; } if (argsRequired > 1) { throw new ArgumentException("Aggregated options can only contain a single option that requires a value. Multiple were present."); } } }
private void SetFullOption(object commandObject, Queue <string> argQ, string options, string value) { var optionProperty = AssemblySearcher .GetCommandOptionPropertyByName( commandObject.GetType(), options.Substring(2)).First(); if (optionProperty.PropertyType == typeof(bool)) { optionProperty.SetValue(commandObject, true); } else if (optionProperty.PropertyType == typeof(string)) { optionProperty.SetValue(commandObject, value ?? argQ.Dequeue()); } else if (_converterFuncs.ContainsKey(optionProperty.PropertyType)) { optionProperty.SetValue(commandObject, _converterFuncs[optionProperty.PropertyType](value ?? argQ.Dequeue())); } }