public static void AppendSwitchIfNotNullOrWhiteSpace(this CommandLineBuilder commandLineBuilder, string switchName, string parameter) { if (!String.IsNullOrWhiteSpace(parameter)) { commandLineBuilder.AppendSwitchIfNotNull(switchName, parameter); } }
public static void AppendSwitchIfNotNullOrEmpty(this CommandLineBuilder builder, string switchName, string parameter) { Condition.Requires(builder, "builder").IsNotNull(); Condition.Requires(switchName, "switchName").IsNotNullOrEmpty(); if (!String.IsNullOrEmpty(parameter)) builder.AppendSwitchIfNotNull(switchName, parameter); }
public static void AppendSwitchIfNotNullOrEmpty(this CommandLineBuilder commandLine, string switchName, string parameter) { Contract.Requires<ArgumentNullException>(commandLine != null, "commandLine"); Contract.Requires<ArgumentNullException>(switchName != null, "switchName"); Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(switchName)); if (!string.IsNullOrEmpty(parameter)) commandLine.AppendSwitchIfNotNull(switchName, parameter); }
public static void AppendSwitchIfAny(this CommandLineBuilder commandLineBuilder, string switchName, IEnumerable<ITaskItem> items) { if (items != null) { foreach (var item in items) { commandLineBuilder.AppendSwitchIfNotNull(switchName, item.ItemSpec); } } }
public static void AppendSwitchIfNotNullOrEmpty(this CommandLineBuilder commandLine, string switchName, string parameter) { if (commandLine == null) throw new ArgumentNullException("commandLine"); if (switchName == null) throw new ArgumentNullException("switchName"); if (string.IsNullOrEmpty(switchName)) throw new ArgumentException("switchName cannot be empty", "switchName"); if (!string.IsNullOrEmpty(parameter)) commandLine.AppendSwitchIfNotNull(switchName, parameter); }
public static void AppendSwitchIfNotNull(this CommandLineBuilder commandLine, string switchName, ITaskItem[] parameters, string[] metadataNames) { if(parameters == null) return; foreach (var item in parameters) { commandLine.AppendSwitchIfNotNull(switchName, item.ItemSpec); if (metadataNames == null) continue; foreach (var metadataName in metadataNames) { var metadata = item.GetMetadata(metadataName); if (metadata != null && metadata.Length > 0) { GetCommandLine(commandLine).Append(','); AppendTextWithQuoting(commandLine, metadata); } } } }
public static void AppendPlusOrMinusSwitch(this CommandLineBuilder commandLine, string switchName, Hashtable bag, string parameterName) { var flag = bag[parameterName]; if (flag != null) commandLine.AppendSwitchIfNotNull(switchName, (bool)flag ? "+" : "-"); }
public static void AppendSwitchIfNotNull(this CommandLineBuilder builder, string switchName, int? value) { if (value != null) builder.AppendSwitchIfNotNull(switchName, value.ToString()); }