예제 #1
0
 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)));
 }
예제 #2
0
        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)));
        }
예제 #3
0
        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)));
        }
예제 #4
0
        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)));
        }
예제 #5
0
        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));
        }
예제 #6
0
 public static IScriptCommand Reset(string variable, IScriptCommand nextCommand)
 {
     return(ScriptCommands.Assign(variable, null));
 }
예제 #7
0
 /// <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()));
 }