static protected bool ExecuteGuiCode(IZeusCodeSegment segment, IZeusContext context) { IZeusExecutionHelper helper = segment.ZeusScriptingEngine.ExecutionHelper; // If the template has an interface block, execute it if (!segment.IsEmpty) { ArrayList reqVars = segment.ITemplate.RequiredInputVariables; if (!context.Input.Contains(reqVars)) { try { helper.EngineExecuteGuiCode(segment, context); if (helper.HasErrors) { IZeusExecutionError[] errors = helper.Errors; helper.ClearErrors(); throw new ZeusExecutionException(segment.ITemplate, errors, false); } } catch (Exception ex) { throw new ZeusRuntimeException(segment.ITemplate, ex, false); } } context.Input.AddItems(context.Gui); } return(!context.Gui.IsCanceled); }
static protected void ExecuteCode(IZeusExecutionHelper helper, IZeusTemplate template, IZeusContext context, ArrayList templateGroupIds) { if (!template.BodySegment.IsEmpty) { try { // Execute Template Body helper.EngineExecuteCode(template.BodySegment, context); if (helper.HasErrors) { IZeusExecutionError[] errors = helper.Errors; helper.ClearErrors(); throw new ZeusExecutionException(template, errors, true); } } catch (Exception ex) { throw new ZeusRuntimeException(template, ex, true); } } if (template.Type == ZeusConstants.Types.GROUP) { if (template.IncludedTemplates.Count > 0) { // Execute Template Body if (templateGroupIds.Contains(template.UniqueID)) { return; } templateGroupIds.Add(template.UniqueID); foreach (ZeusTemplate childTemplate in template.IncludedTemplates) { if (childTemplate.UniqueID != template.UniqueID) { //clear the output buffer before executing the next template! context.Output.clear(); //Push the current template onto the Execution stack if (context is ZeusContext) { ((ZeusContext)context).TemplateStack.Push(childTemplate); } try { IZeusScriptingEngine engine = ZeusFactory.GetEngine(childTemplate.BodySegment.Engine); ExecuteCode(engine.ExecutionHelper, childTemplate, context, templateGroupIds); } finally { //Pop the current template off of the Execution stack if (context is ZeusContext) { ((ZeusContext)context).TemplateStack.Pop(); } } } } } } }
static protected void ExecuteCode(IZeusExecutionHelper helper, IZeusTemplate template, IZeusContext context, ArrayList templateGroupIds) { if (!template.BodySegment.IsEmpty) { try { // Execute Template Body helper.EngineExecuteCode(template.BodySegment, context); if (helper.HasErrors) { IZeusExecutionError[] errors = helper.Errors; helper.ClearErrors(); throw new ZeusExecutionException(template, errors, true); } } catch (Exception ex) { throw new ZeusRuntimeException(template, ex, true); } } if (template.Type == ZeusConstants.Types.GROUP) { if (template.IncludedTemplates.Count > 0) { // Execute Template Body if (templateGroupIds.Contains(template.UniqueID)) return; templateGroupIds.Add(template.UniqueID); foreach (ZeusTemplate childTemplate in template.IncludedTemplates) { if (childTemplate.UniqueID != template.UniqueID) { //clear the output buffer before executing the next template! context.Output.clear(); //Push the current template onto the Execution stack if (context is ZeusContext) { ((ZeusContext)context).TemplateStack.Push(childTemplate); } try { IZeusScriptingEngine engine = ZeusFactory.GetEngine(childTemplate.BodySegment.Engine); ExecuteCode(engine.ExecutionHelper, childTemplate, context, templateGroupIds); } finally { //Pop the current template off of the Execution stack if (context is ZeusContext) { ((ZeusContext)context).TemplateStack.Pop(); } } } } } } }