/// <inheritdoc />
        public async Task <WorkableTask> Execute(NamedCode code, IDictionary <string, object> variables = null, TimeSpan?wait = null)
        {
            IDictionary <string, object> runtimevariables = await variables.TranslateVariables(scriptcompiler, ScriptLanguage.NCScript);

            WorkableTask scripttask = scriptinstances.CreateTask(WorkableType.Script, 0, 0, code.Name, runtimevariables);

            try {
                return(await Execute(await scriptcompiler.CompileCodeAsync(code.Code, code.Language), scripttask, runtimevariables, wait));
            }
            catch (Exception e) {
                scripttask.Log.Add(e.ToString());
                scripttask.Status = TaskStatus.Failure;
                await scriptinstances.FinishTask(scripttask.Id);
            }

            return(scripttask);
        }
Ejemplo n.º 2
0
 public string TestMethod(NamedCode code)
 {
     return(code.Name);
 }