public OptionDetails(System.Reflection.MemberInfo memberInfo, OptionAttribute option, Options optionBundle)
{
this.paramName = null;
this.optionHelp = null;
this.ShortForm = ("" + option.ShortForm).Trim();
if (option.LongForm == null)
{
this.LongForm = string.Empty;
}
else
{
this.LongForm = (option.LongForm != string.Empty) ? option.LongForm : memberInfo.Name;
}
this.AlternateForm = option.AlternateForm;
this.ShortDescription = this.ExtractParamName(option.ShortDescription);
this.Occurs = 0;
this.OptionBundle = optionBundle;
this.BooleanOption = false;
this.MemberInfo = memberInfo;
this.NeedsParameter = false;
this.Values = null;
this.MaxOccurs = 1;
this.VBCStyleBoolean = option.VBCStyleBoolean;
this.SecondLevelHelp = option.SecondLevelHelp;
this.ParameterType = OptionDetails.TypeOfMember(memberInfo);
if (this.ParameterType != null)
{
if (this.ParameterType.FullName != "System.Boolean")
{
if (this.LongForm.IndexOf(':') >= 0)
{
throw new InvalidOperationException("Options with an embedded colon (':') in their visible name must be boolean!!! [" + this.MemberInfo.ToString() + " isn't]");
}
this.NeedsParameter = true;
if (option.MaxOccurs == 1)
{
return;
}
if (this.ParameterType.IsArray)
{
this.Values = new ArrayList();
this.MaxOccurs = option.MaxOccurs;
return;
}
if ((this.MemberInfo is MethodInfo) || (this.MemberInfo is PropertyInfo))
{
this.MaxOccurs = option.MaxOccurs;
return;
}
object[] objArray1 = new object[] { "MaxOccurs set to non default value (", option.MaxOccurs, ") for a [", this.MemberInfo.ToString(), "] option" };
throw new InvalidOperationException(string.Concat(objArray1));
}
this.BooleanOption = true;
if (option.MaxOccurs != 1)
{
if ((this.MemberInfo is MethodInfo) || (this.MemberInfo is PropertyInfo))
{
this.MaxOccurs = option.MaxOccurs;
}
else
{
object[] objArray2 = new object[] { "MaxOccurs set to non default value (", option.MaxOccurs, ") for a [", this.MemberInfo.ToString(), "] option" };
throw new InvalidOperationException(string.Concat(objArray2));
}
}
}
}