/// <summary> /// Execute this command. /// </summary> /// <param name="variables">The variable list of the calling code.</param> public override void Execute(VariableList variables) { string[] processed = ProcessParameters(variables, Parameters); string output = processed[0].Trim(); variables.VariableSet(processed[1], output); }
/// <summary> /// Execute this command. /// </summary> /// <param name="variables">The variable list of the calling code.</param> public override void Execute(VariableList variables) { string[] processed = ProcessParameters(variables, Parameters); string output = processed[0].ToUpper(CultureInfo.CurrentCulture); variables.VariableSet(processed[1], output); }
/// <summary> /// Execute this command. /// </summary> /// <param name="variables">The variable list of the calling code.</param> public override void Execute(VariableList variables) { string[] processed = ProcessParameters(variables, Parameters); string output = String.Concat(processed[0], processed[1]); variables.VariableSet(processed[2], output); }
/// <summary> /// Execute this command. /// </summary> /// <param name="variables">The variable list of the calling code.</param> public override void Execute(VariableList variables) { string[] processed = ProcessParameters(variables, Parameters); string value0 = variables.VariableGet(processed[0]); string value1 = variables.VariableGet(processed[1]); variables.VariableSet(processed[0], value1); variables.VariableSet(processed[1], value0); }
/// <summary> /// Execute this command. /// </summary> /// <param name="variables">The variable list of the calling code.</param> public override void Execute(VariableList variables) { string[] processed = ProcessParameters(variables, Parameters); int input0Int = 0; int.TryParse(processed[0], out input0Int); int output = (int) Math.Sqrt(input0Int); variables.VariableSet(processed[1], output.ToString()); }
/// <summary> /// Execute this command. /// </summary> /// <param name="variables">The variable list of the calling code.</param> public override void Execute(VariableList variables) { string[] processed = ProcessParameters(variables, Parameters); variables.VariableSet(processed[0], processed[1]); }
/// <summary> /// Execute this command. /// </summary> public override void Execute(VariableList variables) { string[] processed = ProcessParameters(variables, Parameters); variables.StackPush(processed[0]); }
/// <summary> /// Processes an array of strings to dereference variables and replace special characters and strings. /// </summary> /// <param name="variables">The variable list.</param> /// <param name="parameters">Array of parameter strings.</param> /// <returns>Processed parameters array of strings.</returns> public static string[] ProcessParameters(VariableList variables, string[] parameters) { string[] processed = new string[parameters.Length]; for (int index = 0; index < parameters.Length; index++) { if (String.IsNullOrEmpty(parameters[index])) { processed[index] = parameters[index]; } else { string newParam = parameters[index]; if (newParam.StartsWith(VariableList.VariablePrefix, StringComparison.OrdinalIgnoreCase)) newParam = variables.VariableGet(newParam.Substring(VariableList.VariablePrefix.Length)); newParam = ReplaceSpecial(newParam); processed[index] = newParam; } } return processed; }
/// <summary> /// Execute this command. /// </summary> /// <param name="variables">The variable list of the calling code.</param> public virtual void Execute(VariableList variables) { }