Example #1
0
		public OptionSet Add (ArgumentSource source)
		{
			if (source == null)
				throw new ArgumentNullException (nameof(source));
			sources.Add (source);
			return this;
		}
 public IntegerArgumentAttribute(string argumentName, ArgumentSource argumentSource) :
     base(argumentName, argumentSource)
 {
     this.DefaultValue = 0;
     this.Min          = 0;
     this.Max          = int.MaxValue;
 }
        // ---------------- Constructor ----------------

        protected BaseAttribute(string argumentName, ArgumentSource argumentSource)
        {
            this.ArgName        = argumentName;
            this.ArgumentSource = argumentSource;
            this.Description    = string.Empty;
            this.Required       = false;
            this.HasSecretValue = false;
        }
Example #4
0
 public OptionSet Add(ArgumentSource source)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     sources.Add(source);
     return(this);
 }
Example #5
0
		public override bool GetArguments (string value, out IEnumerable<string> replacement)
		{
			if (string.IsNullOrEmpty (value) || !value.StartsWith ("@")) {
				replacement = null;
				return false;
			}
			replacement = ArgumentSource.GetArgumentsFromFile (value.Substring (1));
			return true;
		}
        public EnumArgumentAttribute(Type enumType, string argumentName, ArgumentSource argumentSource) :
            base(argumentName, argumentSource)
        {
            if (enumType.IsEnum == false)
            {
                throw new ArgumentException(
                          "Passed in type is not an Enum",
                          nameof(enumType)
                          );
            }

            this.enumType = enumType;

            this.IgnoreCase   = false;
            this.DefaultValue = (Enum)Activator.CreateInstance(enumType);
        }
Example #7
0
        static string[] Parse(string source, int max)
        {
            string[] values = new string [max];
            int      i      = 0;

            foreach (string s in ArgumentSource.GetArguments(new StringReader(source)))
            {
                if (i < (values.Length - 1))
                {
                    values [i++] = s;
                }
                else
                {
                    values [i] = values [i] == null ? s : values [i] + " " + s;
                }
            }
            return(values);
        }
Example #8
0
File: IO.cs Project: sfuller/MonC
 public static void Print(IVMBindingContext context, ArgumentSource args)
 {
     Console.WriteLine("monctest:" + context.GetString(args.GetArgument(0)));
 }
 /// <summary>
 /// Initializes a new instance with the specified values.
 /// </summary>
 public ArgumentValue(object?value, ArgumentSource source)
 {
     Value  = value;
     Source = source;
 }
        // ---------------- Constructor ----------------

        protected BasePathAttribute(string argumentName, ArgumentSource argumentSource) :
            base(argumentName, argumentSource)
        {
            this.DefaultValue = null;
            this.MustExist    = false;
        }
Example #11
0
 public static ImmutableList <string> GetArgumentList(string args)
 {
     using (var tr = new StringReader(args))
         return(ArgumentSource.GetArguments(tr).ToImmutableList());
 }
Example #12
0
 private static void NoOpBinding(IVMBindingContext context, ArgumentSource args)
 {
 }
 public FilePathArgumentAttribute(string argumentName, ArgumentSource argumentSource) :
     base(argumentName, argumentSource)
 {
 }
Example #14
0
 public StringArgumentAttribute(string argumentName, ArgumentSource argumentSource) :
     base(argumentName, argumentSource)
 {
     this.DefaultValue = string.Empty;
 }
Example #15
0
 public BooleanArgumentAttribute(string argumentName, ArgumentSource argumentSource) :
     base(argumentName, argumentSource)
 {
     this.DefaultValue = false;
 }
Example #16
0
 public DirectoryPathArgumentAttribute(string argumentName, ArgumentSource argumentSource) :
     base(argumentName, argumentSource)
 {
 }