private static string Description(CommandLineArgumentAttribute attribute)
 {
     if (attribute != null)
     {
         return(attribute.Description);
     }
     else
     {
         return(null);
     }
 }
 private static CommandLineArgumentType Flags(CommandLineArgumentAttribute attribute, FieldInfo field)
 {
     if (attribute != null)
     {
         return(attribute.Type);
     }
     else if (IsCollectionType(field.FieldType))
     {
         return(CommandLineArgumentType.MultipleUnique);
     }
     else
     {
         return(CommandLineArgumentType.AtMostOnce);
     }
 }
            public Argument(CommandLineArgumentAttribute attribute, FieldInfo field, ErrorReporter reporter)
            {
                this.longName          = CommandLineArgumentParser.LongName(attribute, field);
                this.description       = CommandLineArgumentParser.Description(attribute);
                this.explicitShortName = CommandLineArgumentParser.ExplicitShortName(attribute);
                this.shortName         = CommandLineArgumentParser.ShortName(attribute, field);
                this.elementType       = ElementType(field);
                this.flags             = Flags(attribute, field);
                this.field             = field;
                this.seenValue         = false;
                this.reporter          = reporter;
                this.isDefault         = (attribute != null) && (attribute is DefaultCommandLineArgumentAttribute);

                if (this.IsCollection)
                {
                    this.collectionValues = new ArrayList();
                }

                Debug.Assert(
                    !string.IsNullOrEmpty(this.longName),
                    "The long name must be provided for the argument.");

                Debug.Assert(
                    !this.IsCollection || this.AllowMultiple,
                    "Collection arguments must have allow multiple");

                Debug.Assert(
                    !this.Unique || this.IsCollection,
                    "Unique only applicable to collection arguments");

                Debug.Assert(
                    IsValidElementType(this.Type) || IsCollectionType(this.Type),
                    "The argument type is not valid.");

                Debug.Assert(
                    (this.IsCollection && IsValidElementType(this.elementType)) || (!this.IsCollection && this.elementType == null),
                    "The argument type is not valid.");
            }
 private static bool ExplicitShortName(CommandLineArgumentAttribute attribute)
 {
     return(attribute != null && !attribute.DefaultShortName);
 }
 private static string ShortName(CommandLineArgumentAttribute attribute, FieldInfo field)
 {
     return(!ExplicitShortName(attribute) ? LongName(attribute, field).Substring(0, 1) : attribute.ShortName);
 }
 private static string LongName(CommandLineArgumentAttribute attribute, FieldInfo field)
 {
     return((attribute == null || attribute.DefaultLongName) ? field.Name : attribute.LongName);
 }