public static IScriptCommand IfArrayLength(ComparsionOperator op = ComparsionOperator.GreaterThanOrEqual, string arrayVariable = "{array}", int value = 1, IScriptCommand trueCommand = null, IScriptCommand otherwiseCommand = null) { return (ScriptCommands.Assign("{ArrayLengthValue}", value, IfArrayLength(op, arrayVariable, "{ArrayLengthValue}", trueCommand, otherwiseCommand))); }
public static IScriptCommand IfEquals <T>(string variable = "{variable}", T value = default(T), IScriptCommand trueCommand = null, IScriptCommand otherwiseCommand = null) { string ifEqualValueProperty = "{IfEquals-Value}"; return (ScriptCommands.Assign(ifEqualValueProperty, value, IfValue(ComparsionOperator.Equals, variable, ifEqualValueProperty, trueCommand, otherwiseCommand))); }
public static IScriptCommand RunICommand(ICommand command, string parameterVariable, bool throwIfError = false, IScriptCommand nextCommand = null) { string commandVariable = "{" + string.Format("Command{0}", new Random().Next()) + "}"; return(ScriptCommands.Assign(commandVariable, command, ScriptCommands.RunICommand(commandVariable, parameterVariable, throwIfError, nextCommand))); }
public static IScriptCommand AddValue <T>(string value1Variable = "{Value1}", T[] value2 = null, string destinationVariable = "{Destination}", IScriptCommand nextCommand = null) { value2 = value2 ?? new T[] {}; string value2Variable = ParameterDicUtils.RandomVariable(); return(ScriptCommands.Assign(value2Variable, value2, Add(value1Variable, value2Variable, destinationVariable, nextCommand))); }
public override IScriptCommand Execute(IParameterDic pm) { object value = Value; if (ValueFunc != null) { value = ValueFunc(); } if (!(value is string)) { value = value.ToString(); } else { value = pm.ReplaceVariableInsideBracketed((string)value); } return(ScriptCommands.Assign( VariableKey, value, NextCommand).IfExists(SkipIfExists)); }
public static IScriptCommand Reset(string variable, IScriptCommand nextCommand) { return(ScriptCommands.Assign(variable, null)); }
/// <summary> /// Serializable, remove a variable from ParameterDic. /// </summary> /// <param name="nextCommand"></param> /// <param name="variables"></param> /// <returns></returns> public static IScriptCommand Reset(IScriptCommand nextCommand = null, params string[] variables) { return(ScriptCommands.Run(RunMode.Parallel, nextCommand, variables.Select(v => ScriptCommands.Assign(v, null)).ToArray())); }