public FlagArgumentHandler(object handledObject, MemberInfo memberInfo, ArgumentCollision aCollision, bool required, bool whenSet) : base(handledObject, memberInfo, typeof(bool), true, required) { collision = aCollision; this.whenSet = whenSet; }
public EnumArgumentHandler(object handledObject, MemberInfo memberInfo, Type elementType, ArgumentCollision collision, bool required) : base(handledObject, memberInfo, elementType, false, required) { this.collision = collision; names = (from e in Enum.GetNames(elementType) select new { Key = e.ToLowerInvariant(), Value = e }).ToDictionary(v => v.Key, v => v.Value); }
protected bool CheckCollision(ArgumentCollision aCollision) { if (wasSet) { switch (aCollision) { case ArgumentCollision.Throw: throw new DuplicateArgumentException(String.Format(CultureInfo.CurrentCulture, "Option {0} is specified more than once", Name)); case ArgumentCollision.Ignore: return(false); default: return(true); } } return(true); }
internal bool ShouldAssign(ArgumentCollision collision) { if (!WasSet) { return(true); } switch (collision) { case ArgumentCollision.Throw: throw new DuplicateArgumentException($"Option {Name} is specified more than once"); case ArgumentCollision.Ignore: return(false); case ArgumentCollision.Overwrite: return(true); default: throw new ArgumentOutOfRangeException(nameof(collision), collision, null); } }
public FlagArgumentHandler(Object aObj, MemberInfo aInfo, ArgumentCollision aCollision, bool aRequired, Boolean aWhenSet) : base(aObj, aInfo, typeof(bool), true, aRequired) { collision = aCollision; whenSet = aWhenSet; }
public PlainArgumentHandler(Object aObj, MemberInfo aInfo, Type aType, ArgumentCollision aCollision, bool aRequired) : base(aObj, aInfo, aType, false, aRequired) { collision = aCollision; }
protected bool CheckCollision(ArgumentCollision aCollision) { if (wasSet) { switch (aCollision) { case ArgumentCollision.Throw: throw new DuplicateArgumentException(String.Format(CultureInfo.CurrentCulture, "Option {0} is specified more than once", Name)); case ArgumentCollision.Ignore: return false; default: return true; } } return true; }
public PlainArgumentHandler(object handledObject, MemberInfo memberInternalInfo, Type elementType, ArgumentCollision collision, bool required) : base(handledObject, memberInternalInfo, elementType, false, required) { this.collision = collision; }