コード例 #1
0
    private void processCommands(Operation o)
    {
        MatchEvaluatorHelper evalHelper = new MatchEvaluatorHelper(o);

        foreach (string c in o.Commands)
        {
            if (commandIsValid(c, o.ChangeType))
            {
                string newCommand = expandCommand(c, evalHelper);
                int exitCode;
                string output = "";

                OnLog(string.Format("[{0}] Running {1}",
                                    mCount,
                                    newCommand));

                exitCode = executeCommand(newCommand,
                                          o.WorkingDirectory,
                                          ref output);
                if (exitCode == 0)
                {
                    OnLog(string.Format("[{0}] Result: Success",
                                        mCount));
                }
                else
                {
                    OnLog(string.Format("[{0}] Result: Failure ({1})",
                                        mCount,
                                        exitCode));
                    OnLog(string.Format("[{0}] Output: {1}",
                                        mCount,
                                        output));
                }
            }
        }
    }
コード例 #2
0
 private string expandCommand(string c, MatchEvaluatorHelper e)
 {
     Regex pattern = new Regex(@"\${(?:([e]+):)?(\w+)}", RegexOptions.Compiled);
     MatchEvaluator evaluator = new MatchEvaluator(e.EvaluateMatch);
     return pattern.Replace(c, evaluator);
 }