public string RunScript(Macro m, Ledger l, MacroScriptParameters parameters = null)
        {
            var scriptRunner = new MacroScriptRunner();
            var script       = m.Script;

            if (parameters != null)
            {
                script = parameters.ReplaceParameters(m);
            }
            return(scriptRunner.RunScript(script, l, Context));
        }
Beispiel #2
0
        public string call(string macroName, PythonDictionary parameters = null)
        {
            var macro  = _context.Macros.FirstOrDefault(o => o.Name == macroName);
            var script = macro.Script;

            if (parameters != null)
            {
                var macroParameters = new MacroScriptParameters();
                foreach (var k in parameters.keys())
                {
                    macroParameters.SetParameter((string)k, (string)parameters.get((string)k));
                }
                script = macroParameters.ReplaceParameters(macro);
            }
            var result = _runner.RunScript(script, _ledger, _context);

            return(result);
        }