Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="KeyValueArgument"/> class.
        /// </summary>
        /// <param name="key">The key of the argument.</param>
        /// <param name="value">The argument value.</param>
        /// <param name="format">The format of argument.</param>
        public KeyValueArgument(string key, TextArgument value, string format)
        {
            if (string.IsNullOrEmpty(key))
            {
                throw new ArgumentNullException(nameof(key));
            }
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            if (string.IsNullOrEmpty(format))
            {
                throw new ArgumentNullException(nameof(format));
            }

            _Key    = key;
            _Value  = value;
            _Format = format;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NamedArgument"/> class.
        /// </summary>
        /// <param name="name">The name of the argument.</param>
        /// <param name="value">The argument value.</param>
        /// <param name="format">The format of argument.</param>
        public NamedArgument(string name, IProcessArgument value, string format)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            if (string.IsNullOrEmpty(format))
            {
                throw new ArgumentNullException("format");
            }

            _Name   = name;
            _Value  = value;
            _Format = format;
        }
Пример #3
0
 /// <summary>
 /// Prepend the specified secret text to the argument builder.
 /// </summary>
 /// <param name="builder">The builder.</param>
 /// <param name="switch">The switch preceding the text.</param>
 /// <param name="separator">The separator between the switch and argument</param>
 /// <param name="argument">The secret argument to be prepended.</param>
 /// <returns>The same <see cref="ProcessArgumentBuilder"/> instance so that multiple calls can be chained.</returns>
 public static ProcessArgumentBuilder PrependSwitchSecret(this ProcessArgumentBuilder builder, string @switch, string separator, IProcessArgument argument)
 {
     builder?.Prepend(new SwitchArgument(@switch, new SecretArgument(argument), separator));
     return(builder);
 }
Пример #4
0
 /// <summary>
 /// Prepend the specified secret text to the argument builder.
 /// </summary>
 /// <param name="builder">The builder.</param>
 /// <param name="switch">The switch preceding the text.</param>
 /// <param name="argument">The secret argument to be prepended.</param>
 /// <returns>The same <see cref="ProcessArgumentBuilder"/> instance so that multiple calls can be chained.</returns>
 public static ProcessArgumentBuilder PrependSwitchSecret(this ProcessArgumentBuilder builder, string @switch, IProcessArgument argument)
 {
     return(PrependSwitchSecret(builder, @switch, " ", argument));
 }
Пример #5
0
 /// <summary>
 /// Prepend the specified secret text to the argument builder.
 /// </summary>
 /// <param name="builder">The builder.</param>
 /// <param name="argument">The secret argument to be prepended.</param>
 /// <returns>The same <see cref="ProcessArgumentBuilder"/> instance so that multiple calls can be chained.</returns>
 public static ProcessArgumentBuilder PrependSecret(this ProcessArgumentBuilder builder, IProcessArgument argument)
 {
     builder?.Prepend(new SecretArgument(argument));
     return(builder);
 }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NameValueArgument"/> class.
 /// </summary>
 /// <param name="name">The name part of the argument.</param>
 /// <param name="separator">The separator between the name and the value.</param>
 /// <param name="value">The value part of the argument.</param>
 public NameValueArgument(string name, string separator, IProcessArgument value)
     : base(new TextArgument(name), new TextArgument(separator), value)
 {
 }
 /// <summary>
 /// Quotes and appends the specified argument to the argument builder.
 /// </summary>
 /// <param name="builder">The builder.</param>
 /// <param name="argument">The argument to be quoted and appended.</param>
 /// <returns>The same <see cref="ProcessArgumentBuilder"/> instance so that multiple calls can be chained.</returns>
 public static ProcessArgumentBuilder AppendQuoted(this ProcessArgumentBuilder builder, IProcessArgument argument)
 {
     if (builder != null)
     {
         builder.Append(new QuotedArgument(argument));
     }
     return(builder);
 }
 /// <summary>
 /// Quotes and appends the specified secret text to the argument builder.
 /// </summary>
 /// <param name="builder">The builder.</param>
 /// <param name="switch">The switch preceding the text.</param>
 /// <param name="argument">The secret argument to be appended.</param>
 /// <returns>The same <see cref="ProcessArgumentBuilder"/> instance so that multiple calls can be chained.</returns>
 public static ProcessArgumentBuilder AppendQuotedSecret(this ProcessArgumentBuilder builder, string @switch, IProcessArgument argument)
 {
     return(ProcessArgumentListExtensions.AppendQuotedSecret(builder, @switch, " ", argument));
 }
Пример #9
0
 /// <summary> Quotes and appends the specified secret text to the argument builder. </summary>
 /// <param name="builder">  The builder. </param>
 /// <param name="switch">   The switch preceding the text. </param>
 /// <param name="argument"> The secret argument to be appended. </param>
 /// <returns>
 ///     The same <see cref="ArgumentBuilder"/> instance so that multiple calls can be
 ///     chained.
 /// </returns>
 public static ArgumentBuilder AppendQuotedSecret(this ArgumentBuilder builder, string @switch, IProcessArgument argument)
 {
     return(AppendQuotedSecret(builder, @switch, " ", argument));
 }
Пример #10
0
 /// <summary> Quotes and appends the specified argument to the argument builder. </summary>
 /// <param name="builder">   The builder. </param>
 /// <param name="switch">    The switch preceding the text. </param>
 /// <param name="separator"> The separator between the switch and argument. </param>
 /// <param name="argument">  The argument to be quoted and appended. </param>
 /// <returns>
 ///     The same <see cref="ArgumentBuilder"/> instance so that multiple calls can be
 ///     chained.
 /// </returns>
 public static ArgumentBuilder AppendSwitchQuoted(this ArgumentBuilder builder, string @switch, string separator, IProcessArgument argument)
 {
     builder?.Append(new SwitchArgument(@switch, new QuotedArgument(argument), separator));
     return(builder);
 }
Пример #11
0
 /// <summary> Quotes and appends the specified secret text to the argument builder. </summary>
 /// <param name="builder">  The builder. </param>
 /// <param name="argument"> The secret argument to be appended. </param>
 /// <returns>
 ///     The same <see cref="ArgumentBuilder"/> instance so that multiple calls can be
 ///     chained.
 /// </returns>
 public static ArgumentBuilder AppendQuotedSecret(this ArgumentBuilder builder, IProcessArgument argument)
 {
     builder?.AppendQuoted(new SecretArgument(argument));
     return(builder);
 }
Пример #12
0
 /// <summary> Quotes and prepends the specified argument to the argument builder. </summary>
 /// <param name="builder">  The builder. </param>
 /// <param name="argument"> The argument to be quoted and prepended. </param>
 /// <returns>
 ///     The same <see cref="ArgumentBuilder"/> instance so that multiple calls can be
 ///     chained.
 /// </returns>
 public static ArgumentBuilder PrependQuoted(this ArgumentBuilder builder, IProcessArgument argument)
 {
     builder?.Prepend(new QuotedArgument(argument));
     return(builder);
 }
Пример #13
0
 /// <summary>
 /// Appends an argument.
 /// </summary>
 /// <param name="argument">The argument.</param>
 public void Append(IProcessArgument argument)
 {
     _tokens.Add(argument);
 }
Пример #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SecretArgument"/> class.
 /// </summary>
 /// <param name="argument">The argument.</param>
 public SecretArgument(IProcessArgument argument)
 {
     _argument = argument;
 }
Пример #15
0
 /// <summary> Quotes and prepend the specified secret text to the argument builder. </summary>
 /// <param name="builder">   The builder. </param>
 /// <param name="switch">    The switch preceding the text. </param>
 /// <param name="separator"> The separator between the switch and argument. </param>
 /// <param name="argument">  The secret argument to be prepended. </param>
 /// <returns>
 ///     The same <see cref="ArgumentBuilder"/> instance so that multiple calls can be
 ///     chained.
 /// </returns>
 public static ArgumentBuilder PrependQuotedSecret(this ArgumentBuilder builder, string @switch, string separator, IProcessArgument argument)
 {
     builder?.PrependSwitchQuoted(@switch, separator, new SecretArgument(argument));
     return(builder);
 }
Пример #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NamedArgument"/> class.
 /// </summary>
 /// <param name="name">The name of the argument.</param>
 /// <param name="value">The argument value.</param>
 public NamedArgument(string name, IProcessArgument value)
     : this(name, value, NamedArgument.DefaultFormat)
 {
 }
Пример #17
0
 /// <summary>
 /// Quotes and appends the specified argument to the argument builder.
 /// </summary>
 /// <param name="builder">The builder.</param>
 /// <param name="switch">The switch preceding the text.</param>
 /// <param name="argument">The argument to be quoted and appended.</param>
 /// <returns>The same <see cref="ProcessArgumentBuilder"/> instance so that multiple calls can be chained.</returns>
 public static ProcessArgumentBuilder AppendSwitchQuoted(this ProcessArgumentBuilder builder, string @switch, IProcessArgument argument)
 {
     return(AppendSwitchQuoted(builder, @switch, " ", argument));
 }
Пример #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SwitchArgument"/> class.
 /// </summary>
 /// <param name="switch">The switch.</param>
 /// <param name="argument">The argument.</param>
 /// <param name="separator">The separator between the <paramref name="switch"/> and the <paramref name="argument"/>.</param>
 public SwitchArgument(string @switch, IProcessArgument argument, string separator = " ")
 {
     _switch    = @switch;
     _argument  = argument;
     _separator = separator;
 }
        /// <summary>
        /// Appends the specified secret argument as a string-literal to the argument builder.
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="name">The argument name.</param>
        /// <param name="argument">The secret argument to be appended.</param>
        /// <returns>The same <see cref="ProcessArgumentBuilder"/> instance so that multiple calls can be chained.</returns>
        public static ProcessArgumentBuilder AppendStringLiteralSecret(this ProcessArgumentBuilder builder, string name, IProcessArgument argument)
        {
            if (builder != null)
            {
                builder.Append(new NamedArgument(name, new StringLiteralArgument(new SecretArgument(argument))));
            }

            return(builder);
        }
 /// <summary>
 /// Quotes and appends the specified secret text to the argument builder.
 /// </summary>
 /// <param name="builder">The builder.</param>
 /// <param name="switch">The switch preceding the text.</param>
 /// <param name="separator">The separator between the switch and argument</param>
 /// <param name="argument">The secret argument to be appended.</param>
 /// <returns>The same <see cref="ProcessArgumentBuilder"/> instance so that multiple calls can be chained.</returns>
 public static ProcessArgumentBuilder AppendQuotedSecret(this ProcessArgumentBuilder builder, string @switch, string separator, IProcessArgument argument)
 {
     if (builder != null)
     {
         builder.AppendSwitchQuoted(@switch, separator, new SecretArgument(argument));
     }
     return(builder);
 }
        /// <summary>
        /// Quotes and appends the specified argument to the argument builder.
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="name">The argument name.</param>
        /// <param name="argument">The argument to be quoted and appended.</param>
        /// <param name="format">The format of the named argument.</param>
        /// <returns>The same <see cref="ProcessArgumentBuilder"/> instance so that multiple calls can be chained.</returns>
        public static ProcessArgumentBuilder AppendQuoted(this ProcessArgumentBuilder builder, string name, IProcessArgument argument, string format)
        {
            if (builder != null)
            {
                builder.Append(new NamedArgument(name, new QuotedArgument(argument), format));
            }

            return(builder);
        }
Пример #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QuotedArgument"/> class.
 /// </summary>
 /// <param name="argument">The argument.</param>
 public QuotedArgument(IProcessArgument argument)
 {
     _argument = argument;
 }
Пример #23
0
 /// <summary>
 /// Initializes an instance of the <see cref="StringLiteralArgument"/> class.
 /// </summary>
 /// <param name="argument">An <see cref="IProcessArgument"/> to wrap as a string-literal.</param>
 public StringLiteralArgument(IProcessArgument argument)
 {
     _argument = argument;
 }