Пример #1
0
        public Parameter(ICreateParameterCatagory catagoryCreator, IParameterCatagory <TArgumentOptions> currentCatagory, PropertyInfo property, uint position)
        {
            if (!ArgumentParser.SupportedTypes.Contains(typeof(TArgument)))
            {
                throw new ArgumentException(
                          $"{typeof(TArgument).Name} is not supported as a parameter type for {property.Name}. Please use only one of the supported types as found in {nameof(ArgumentParser.SupportedTypes)}",
                          nameof(TArgument));
            }

            if (property.GetMethod == null || property.SetMethod == null)
            {
                throw new ArgumentException(
                          $"Property '{property.Name}' must have both a get and set accessor on catagory '{typeof(TArgumentOptions).Name}'.",
                          nameof(property));
            }

            _catagoryCreator = catagoryCreator;
            _currentCatagory = currentCatagory;
            Property         = property;

            Name(property.Name.ToUpperInvariant());

            ParameterType = typeof(TArgument);

            Position = position;
        }
Пример #2
0
        public ParameterCatagory(ICreateParameterCatagory catagoryCreator, string name, uint startAt)
        {
            _catagoryCreator = catagoryCreator;
            CatagoryName     = ArgumentHelper.FormatModuleName(name);

            PositionStart = startAt;
        }
Пример #3
0
 public MultiParameter(ICreateParameterCatagory catagoryCreator, IParameterCatagory <TArgumentOptions> currentCatagory, PropertyInfo property, uint position)
     : base(catagoryCreator, currentCatagory, property, position)
 {
     IsMultiple = true;
 }