Example #1
0
        public virtual void LoadArguments(ArgumentCollection argCollection)
        {
            LoadOptionsOnly(argCollection);

            FieldInfo[] fields = this.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance);
            argCollection.CheckNoMoreOptions(fields.Length - NumOptionalArgs - 1); // -1 accounts for END_OPTIONAL

            for (int i = NumOptionalArgs + 1; i < fields.Length; i++)
            {
                try
                {
                    LoadRequiredParameter(fields[i], argCollection);
                }
                catch (Exception e)
                {
                    throw new ArgumentException("Error parsing required argument." + e.InnerException.Message);
                }
            }

            argCollection.CheckThatEmpty();
            CheckConstraints();
        }