private void LoadInterpreters()
        {
            List<ComComponent> ComComponents = new List<ComComponent>();

            MgaRegistrar registrar = new MgaRegistrar();
            regaccessmode_enum r = regaccessmode_enum.REGACCESS_BOTH;
            IEnumerable components = (IEnumerable)(object)registrar.GetComponentsDisp(r);

            string paradigm = "CyPhyML";

            foreach (string comProgId in components)
            {
                try
                {
                    bool isAssociated;
                    bool canAssociate;

                    registrar.IsAssociated(comProgId, paradigm, out isAssociated, out canAssociate, r);
                    string DllPath = registrar.LocalDllPath[comProgId];

                    componenttype_enum Type;
                    string desc;
                    registrar.QueryComponent(
                        comProgId,
                        out Type,
                        out desc,
                        regaccessmode_enum.REGACCESS_BOTH);

                    bool isInterpreter = false;
                    isInterpreter = (Type == componenttype_enum.COMPONENTTYPE_INTERPRETER);

                    if (canAssociate &&
                        File.Exists(DllPath) &&
                        isInterpreter)
                    {
                        ComComponent component = new ComComponent(comProgId);
                        if (component.isValid)
                        {
                            ComComponents.Add(component);
                        }
                    }
                }
                catch (System.Runtime.InteropServices.COMException)
                {
                    // don't add to list
                }
            }

            lbInterpreters.Items.Clear();
            ComComponents.Sort((Comparison<ComComponent>)((a, b) => a.ToString().CompareTo(b.ToString())));
            foreach (ComComponent c in ComComponents)
            {
                lbInterpreters.Items.Add(c);
            }
        }
        public bool EnqueueJob(
            string runCommand,
            string title,
            string testbenchName,
            string workingDirectory,
            ComComponent interpreter,
            Job.TypeEnum type = Job.TypeEnum.Command)
        {
            // TODO: cut down the number of input variables. interpreter and title should be enough
            try
            {
                JobServer manager;
                Job j = CreateJob(out manager);

                j.RunCommand = runCommand;
                j.Title = title;
                j.TestBenchName = testbenchName;
                j.WorkingDirectory = workingDirectory;
                j.Type = type;

                // TODO: allow empty Labels
                j.Labels = String.IsNullOrWhiteSpace(interpreter.result.Labels) ?
                    Job.DefaultLabels :
                    interpreter.result.Labels;

                j.BuildQuery = String.IsNullOrWhiteSpace(interpreter.result.BuildQuery) ?
                    Job.DefaultBuildQuery :
                    interpreter.result.BuildQuery;

                if (String.IsNullOrWhiteSpace(interpreter.result.ZippyServerSideHook) == false)
                {
                    j.ResultsZip = interpreter.result.ZippyServerSideHook as string;
                }

                jobsToAdd.Enqueue(new KeyValuePair<JobServer, Job>(manager, j));
                return true;

            }
            catch (System.Net.Sockets.SocketException ex)
            {
                throw new Exception("JobManager is not running. Please start it.", ex);
            }
            catch (Exception e)
            {
                // TODO: just log
                throw new Exception(string.Format("=> Job cannot be posted: {0}", e.ToString()));
            }
        }
        public void Draw(uint hdc)
        {
            // VERY important to cast to int
            System.IntPtr hdcptr;
            unchecked { hdcptr = (System.IntPtr)(int)hdc; }

            // Create graphics object
            Graphics g = Graphics.FromHdc(hdcptr);

            // Set up string format for the label
            StringFormat sf = new StringFormat(StringFormatFlags.NoClip);
            sf.Alignment = StringAlignment.Center;
            sf.LineAlignment = StringAlignment.Center;

            // Drawing style
            Pen pen = new Pen(color);
            Brush brush = new SolidBrush(color);
#if DEBUG
            // Draw the place
            g.DrawRectangle(pen, x, y, w, h);
#endif
            Color contentColor = Color.Black;
            string Content = "";
            //if (myobj == null)
            //{
            //  g.Dispose();
            //  return;
            //}
            if (LastMetaKind == "Task")
            {
                Icon icon = null;
                if (interpreters[TaskProgId].isValid)
                {
                    contentColor = Color.Blue;
                    Content = interpreters[TaskProgId].ToolTip;
                    if (string.IsNullOrWhiteSpace(Content))
                    {
                        Content = interpreters[TaskProgId].Name;
                    }
                    if (Content.StartsWith("MGA.Interpreter.", StringComparison.InvariantCultureIgnoreCase))
                    {
                        Content = Content.Substring("MGA.Interpreter.".Length);
                    }
                    MgaRegistrar registrar = new MgaRegistrar();
                    string DllFileName = registrar.LocalDllPath[TaskProgId];
                    try
                    {
                        // TODO: we should read this from the registry...
                        // if the value is ,IDI_COMPICON get the icon from the dll
                        string iconFileNameGuess = Path.ChangeExtension(DllFileName, ".ico");
                        var temp = registrar.get_IconPath(regaccessmode_enum.REGACCESS_USER);

                        if (File.Exists(iconFileNameGuess))
                        {
                            icon = Icon.ExtractAssociatedIcon(iconFileNameGuess);
                        }
                        else
                        {
                            icon = Icon.ExtractAssociatedIcon(DllFileName);
                        }
                    }
                    catch (ArgumentException)
                    {
                    }
                }
                else
                {
                    contentColor = Color.Red;
                    Content = "INVALID" + Environment.NewLine + TaskProgId;
                    icon = InvalidTask;
                }
                using (Icon icon2 = new Icon(icon, IconWidth, IconHeight))
                    g.DrawIcon(icon2, new Rectangle(x, y, IconWidth, IconHeight));

                g.DrawString(
                    Content,
                    SystemFonts.DefaultFont,
                    new SolidBrush(contentColor),
                    new RectangleF(
                        x,
                        y + h + 15,
                        g.MeasureString(Content, SystemFonts.DefaultFont).Width,
                        g.MeasureString(Content, SystemFonts.DefaultFont).Height),
                    sf);

                /*
                g.DrawString(
                    Parameters,
                    SystemFonts.DefaultFont,
                    new SolidBrush(Color.DarkGreen),
                    new RectangleF(
                        x,
                        y + h + 25,
                        g.MeasureString(Parameters, SystemFonts.DefaultFont).Width,
                        g.MeasureString(Parameters, SystemFonts.DefaultFont).Height),
                    sf);
                 */
            }
            else if (LastMetaKind == "WorkflowRef")
            {
                int i = 0;
                Icon icon = null;

                foreach (TaskInfo taskInfo in workflow)
                {
                    if (taskInfo.IsComComponent)
                    {
                        var comComponent = new ComComponent(taskInfo.COMName);
                        if (comComponent.isValid)
                        {
                            MgaRegistrar registrar = new MgaRegistrar();
                            string DllFileName = registrar.LocalDllPath[comComponent.ProgId];
                            try
                            {
                                // TODO: we should read this from the registry...
                                // if the value is ,IDI_COMPICON get the icon from the dll
                                string iconFileNameGuess = Path.ChangeExtension(DllFileName, ".ico");

                                if (File.Exists(iconFileNameGuess))
                                {
                                    icon = Icon.ExtractAssociatedIcon(iconFileNameGuess);
                                }
                                else
                                {
                                    icon = Icon.ExtractAssociatedIcon(DllFileName);
                                }
                            }
                            catch (ArgumentException)
                            {
                            }
                        }
                        else
                        {
                            // draw error image
                            icon = InvalidTask;
                        }
                    }
                    else
                    {
                        string iconFileName = taskInfo.IconName;
                        if (!string.IsNullOrWhiteSpace(iconFileName) &&
                            File.Exists(iconFileName))
                        {
                            Bitmap bitmap = (Bitmap)Image.FromFile(iconFileName);
                            icon = Icon.FromHandle(bitmap.GetHicon());
                        }
                        else
                        {
                            icon = InvalidTask;
                        }
                    }

                    try
                    {
                        int IconStartX = x + (IconWidth + TaskPadding) * i;
                        g.DrawIcon(new Icon(icon, IconWidth, IconHeight),
                            new Rectangle(IconStartX, y, IconWidth, IconHeight));

                        if (taskInfo != workflow.Reverse().FirstOrDefault())
                        {
                            Pen p = new Pen(Color.Black, LineWidth);
                            p.StartCap = LineStartCap;
                            p.EndCap = LineEndCap;
                            int LineStartX = IconStartX + IconWidth;
                            g.DrawLine(p,
                                new Point(
                                    LineStartX + LineStartPadding,
                                    y + IconHeight / 2),
                                new Point(
                                    LineStartX + TaskPadding - LineEndPadding,
                                    y + IconHeight / 2));
                        }
                        i++;
                    }
                    catch (ArgumentException)
                    {
                    }

                }
                if (workflow != null)
                {
                    if (workflow.Count == 0 ||
                        icon == null)
                    {
                        icon = UndefinedWorkFlow;
                        g.DrawIcon(
                            new Icon(icon, IconWidth, IconHeight),
                            new Rectangle(x, y, IconWidth, IconHeight));
                    }
                }
            }

            // Draw the label
            g.DrawString(name, SystemFonts.DefaultFont, new SolidBrush(labelColor), 
                new RectangleF(x + w / 2 - LabelSize.Width / 2, y + h + 5, LabelSize.Width, 10), sf);

            sf.Dispose();
            g.Dispose();
        }
        public void MouseLeftButtonDoubleClick(uint nFlags, int pointx, int pointy, ulong transformHDC)
        {
            ComComponent c = new ComComponent(TaskProgId);
            Dictionary<string, string> ParametersDict = new Dictionary<string, string>();
            if (string.IsNullOrWhiteSpace(Parameters) == false)
            {
                try
                {
                    ParametersDict = (Dictionary<string, string>)JsonConvert.DeserializeObject(Parameters, typeof(Dictionary<string, string>));
                }
                catch (Newtonsoft.Json.JsonReaderException) { }
            }

            foreach (var parameter in c.WorkflowParameterList.Where(p => !ParametersDict.ContainsKey(p)))
            {
                ParametersDict[parameter] = c.GetWorkflowParameterValue(parameter);
            }

            List<ParameterSettingsForm.Parameter> parameters;
            parameters = ParametersDict.Select(x => new ParameterSettingsForm.Parameter()
            {
                Name = x.Key,
                Value = x.Value,
            }).ToList();

            using (ParameterSettingsForm form = new ParameterSettingsForm(parameters, TaskProgId))
            {
                if (c != null && c.isValid)
                {
                    form.ShowDialog();
                    Dictionary<String, String> d = form.parameters.ToDictionary(p => p.Name, p => p.Value);
                    string serialized = JsonConvert.SerializeObject(d, Formatting.Indented);
                    myobj.Project.BeginTransactionInNewTerr();
                    try
                    {
                        Parameters = myobj.StrAttrByName["Parameters"] = serialized;
                    }
                    catch
                    {
                        myobj.Project.AbortTransaction();
                    }
                    myobj.Project.CommitTransaction();
                }
            }
        }
        public void Initialize(
            MgaProject project,
            MgaMetaPart meta,
            MgaFCO obj)
        {
            // only store temporarily, they might be unavailable later
            myobj = obj;
            mymetaobj = null;
            LastMetaKind = myobj.Meta.Name;

            // obtain the metaobject
            GetMetaFCO(meta, out mymetaobj);

            if (obj != null)
            {
                // concrete object
                name = myobj.Name;
                if (myobj.Meta.Name == "Task")
                {
                    // task
                    // get progid check whether it is already in the cache
                    TaskProgId = myobj.StrAttrByName["COMName"];
                    if (interpreters.Keys.Contains(TaskProgId) == false)
                    {
                        // create an instance
                        ComComponent task = new ComComponent(TaskProgId);
                        interpreters.Add(TaskProgId, task);
                    }
                    // save parameters
                    Parameters = myobj.StrAttrByName["Parameters"];
                    h = IconHeight;
                    w = IconWidth;
                }
                else if (myobj.Meta.Name == "WorkflowRef")
                {
                    // Workflow reference get the tasks
                    // TODO: get those in the right order
                    workflow.Clear();
                    MgaReference wfRef = myobj as MgaReference;
                    Queue<string> items = new Queue<string>();
                    List<MgaAtom> tasks = new List<MgaAtom>();
                    List<MgaFCO> processed = new List<MgaFCO>();

                    if (wfRef.Referred != null)
                    {
                        tasks.AddRange(wfRef.Referred.ChildObjects.OfType<MgaAtom>());

                        MgaAtom StartTask = null;

                        StartTask = tasks.
                            Where(x => x.ExSrcFcos().Count() == 0).
                            FirstOrDefault();

                        if (StartTask != null)
                        {
                            this.EnqueueTask(StartTask as MgaFCO);
                            processed.Add(StartTask as MgaFCO);

                            MgaFCO NextTask = StartTask.ExDstFcos().FirstOrDefault();

                            // avoid loops
                            while (NextTask != null &&
                                processed.Contains(NextTask) == false)
                            {
                                processed.Add(NextTask as MgaFCO);
                                this.EnqueueTask(NextTask);
                                NextTask = NextTask.ExDstFcos().FirstOrDefault();
                            }
                        }
                    }
                    h = IconHeight;
                    if (workflow.Count > 0)
                    {
                        w = IconWidth * workflow.Count +
                            TaskPadding * (workflow.Count - 1);
                    }
                    else
                    {
                        w = IconWidth;
                    }
                }
            }
            else
            {
                // not a concreter object (maybe in part browser?)
                name = mymetaobj.DisplayedName;
            }

            // to handle color and labelColor settings in GME
            if (!GetColorPreference(out color, "color"))
            {
                color = Color.Black;
            }
            if (!GetColorPreference(out labelColor, "nameColor"))
            {
                labelColor = Color.Black;
            }

            // null them for sure
            // myobj = null;
            mymetaobj = null;
        }
        public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig)
        {
            var config = (CADAnalysisConfig)preConfig;
            ComComponent cyPhy2CAD = new ComComponent("MGA.Interpreter.CyPhy2CAD_CSharp");
            bool cyPhy2CADConfigWasSuccessful =  cyPhy2CAD.DoGUIConfiguration(config.ProjectDirectory);
            if (cyPhy2CADConfigWasSuccessful == false)
            {
                return null;
            }
            // TODO: when CyPhy2CAD implements ICyPhyInterpreter, save its config in ours
            CyPhy2CAD_CSharp.CyPhy2CADSettings cadSettings = (CyPhy2CAD_CSharp.CyPhy2CADSettings)(cyPhy2CAD.InterpreterConfig);
            config.AuxiliaryDirectory = cadSettings.AuxiliaryDirectory;
            config.StepFormats = cadSettings.StepFormats;

            return config;
        }
        // JS: 7/15/13
        private void CallComponentExporter(
            MgaProject project,
            MgaFCO currentobj,
            MgaFCOs selectedobjs,
            int param)
        {
            Type tCAD = Type.GetTypeFromProgID("MGA.Interpreter.CyPhyComponentExporter");
            if (tCAD == null)
            {
                GMEConsole.Info.WriteLine("CyPhyComponentExporter is not installed on your machine.");
                return;
            }
            ComComponent cyPhyCompExp = new ComComponent("MGA.Interpreter.CyPhyComponentExporter");
            cyPhyCompExp.Initialize(project);

            // call component exporter to traverse design and build component index
            CyPhyComponentExporter.CyPhyComponentExporterInterpreter compExport = new CyPhyComponentExporter.CyPhyComponentExporterInterpreter();
            compExport.Initialize(project);
            compExport.TraverseTestBenchForComponentExport(currentobj, this.OutputDirectory, this.ProjectRootDirectory);
        }
        private void CallCAD(
            MgaProject project,
            MgaFCO currentobj,
            MgaFCOs selectedobjs,
            int param)
        {
            Type tCAD = Type.GetTypeFromProgID("MGA.Interpreter.CyPhy2CAD_CSharp");
            if (tCAD == null)
            {
                GMEConsole.Info.WriteLine("CyPhy2CAD is not installed on your machine.");
                return;
            }
            ComComponent cyPhy2CAD = new ComComponent("MGA.Interpreter.CyPhy2CAD_CSharp");
            //cyPhy2CAD.WorkflowParameters["prepIFab"] = "true";
            cyPhy2CAD.Initialize(project);
            cyPhy2CAD.InterpreterConfig = cadSettings;
            // TODO cyPhy2CAD.MainParameters.config.CADAnalysis = true;
            //cyPhy2CAD.MainParameters.ConsoleMessages = ;
            cyPhy2CAD.MainParameters.Project = project;
            cyPhy2CAD.MainParameters.CurrentFCO = currentobj;
            cyPhy2CAD.MainParameters.SelectedFCOs = (MgaFCOs)Activator.CreateInstance(Type.GetTypeFromProgID("Mga.MgaFCOs"));
            cyPhy2CAD.MainParameters.StartModeParam = param;
            cyPhy2CAD.MainParameters.OutputDirectory = this.OutputDirectory;
            cyPhy2CAD.MainParameters.ProjectDirectory = this.ProjectRootDirectory;
            cyPhy2CAD.MainParameters.Traceability = (META.MgaTraceability) this.result.Traceability;
            cyPhy2CAD.Main();


            this.componentParameters["results_zip_py"] = cyPhy2CAD.result.ZippyServerSideHook;
        }
        public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig)
        {
            var config = (PrepareIFabConfig)preConfig;
            ComComponent cyPhy2CAD = new ComComponent("MGA.Interpreter.CyPhy2CAD_CSharp");
            cyPhy2CAD.DoGUIConfiguration(config.ProjectDirectory);
            // TODO: when CyPhy2CAD implements ICyPhyInterpreter, save its config in ours
            CyPhy2CAD_CSharp.CyPhy2CADSettings cadSettings = (CyPhy2CAD_CSharp.CyPhy2CADSettings)(cyPhy2CAD.InterpreterConfig);
            config.AuxiliaryDirectory = cadSettings.AuxiliaryDirectory;
            config.StepFormats = cadSettings.StepFormats;

            return config;
        }
        public override Queue<ComComponent> GetWorkflow()
        {
            // TODO: implement this method appropriately
            Queue<ComComponent> workflow = new Queue<ComComponent>();

            this.ExecuteInTransaction(() =>
            {
                var workflowRef = this.testBenchType
                    .Children
                    .WorkflowRefCollection
                    .ToList();

                if (workflowRef.Count == 0)
                {
                    if (this.testBenchType.Kind == typeof(CyPhy.CADTestBench).Name)
                    {
                        // use CyPhy2CAD by default
                        workflow.Enqueue(new ComComponent("MGA.Interpreter.CyPhy2CAD_CSharp", true));
                    }
                    else if (this.testBenchType.Kind == typeof(CyPhy.KinematicTestBench).Name)
                    {
                        // use CyPhy2CAD_CSharp by default
                        workflow.Enqueue(new ComComponent("MGA.Interpreter.CyPhy2CAD_CSharp", true));
                    }
                    else if (this.testBenchType.Kind == typeof(CyPhy.BlastTestBench).Name)
                    {
                        // use CyPhy2CAD_CSharp by default
                        workflow.Enqueue(new ComComponent("MGA.Interpreter.CyPhy2CAD_CSharp", true));
                    }
                    else if (this.testBenchType.Kind == typeof(CyPhy.BallisticTestBench).Name)
                    {
                        // use CyPhy2CAD_CSharp by default
                        workflow.Enqueue(new ComComponent("MGA.Interpreter.CyPhy2CAD_CSharp", true));
                    }
                    else if (this.testBenchType.Kind == typeof(CyPhy.CFDTestBench).Name)
                    {
                        // use CyPhy2CAD_CSharp by default
                        workflow.Enqueue(new ComComponent("MGA.Interpreter.CyPhy2CAD_CSharp", true));
                    }
                    else
                    {
                        // use NOTHING by default see JIRA
                    }
                }
                else if (workflowRef.Count == 1)
                {
                    workflow.Clear();

                    Queue<string> items = new Queue<string>();
                    var tasks = new List<CyPhy.Task>();
                    var processed = new List<CyPhy.TaskBase>();

                    if (workflowRef[0].Referred.Workflow != null)
                    {
                        //tasks.AddRange(workflowRef[0].Referred.Workflow.Children.TaskCollection);

                        //CyPhy.Task startTask = null;

                        //startTask = tasks
                        //    .Where(x => x.AllSrcConnections.Count() == 0)
                        //    .FirstOrDefault();

                        // TODO: signal a warning/error if there are multiple sources

                        CyPhy.Task nextTask = this.GetInitialTask(workflowRef[0].Referred.Workflow);

                        // avoid loops
                        while (nextTask != null &&
                                processed.Contains(nextTask) == false)
                        {
                            processed.Add(nextTask);
                            ComComponent component = new ComComponent(nextTask.Attributes.COMName);
                            if (component.isValid == false)
                            {
                                throw new ApplicationException("Could not create " + nextTask.Attributes.COMName);
                            }
                            string parameters = nextTask.Attributes.Parameters;

                            try
                            {
                                component.WorkflowParameters = (Dictionary<string, string>)JsonConvert.DeserializeObject(parameters, typeof(Dictionary<string, string>));
                                if (component.WorkflowParameters == null)
                                {
                                    component.WorkflowParameters = new Dictionary<string, string>();
                                }
                            }
                            catch (JsonException ex)
                            {
                                throw new ApplicationException(String.Format("Could not parse Parameters for '{0}'", nextTask.Name), ex);
                            }
                            workflow.Enqueue(component);                            

                            var flow = nextTask.DstConnections.FlowCollection.FirstOrDefault();
                            if (flow == null)
                            {
                                nextTask = null;
                            }
                            else // skip all execution tasks
                            {
                                var taskBase = flow.DstEnds.TaskBase;
                                while (taskBase != null &&
                                        processed.Contains(taskBase) == false)
                                {
                                    if (taskBase.Impl.MetaBase.Name == (typeof(CyPhy.Task).Name))
                                    {
                                        nextTask = CyPhyClasses.Task.Cast(taskBase.Impl);
                                        break;
                                    }

                                    processed.Add(taskBase);
                                    flow = taskBase.DstConnections.FlowCollection.FirstOrDefault();
                                    if (flow == null)
                                    {
                                        taskBase = null;
                                        nextTask = null;
                                        break;
                                    }
                                    else
                                    {
                                        taskBase = flow.DstEnds.TaskBase;
                                    }
                                }
                            }
                        }
                    }
                }
                else if (workflowRef.Count > 1)
                {
                    // not supported
                    throw new NotImplementedException("WorkflowRef is greater than 1.");
                }
            });
            return workflow;
        }
Beispiel #11
0
        public void Run()
        {

            AVM.DDP.MetaAvmProject avmProj;
            var terr = this.Project.BeginTransactionInNewTerr();
            try
            {
            this.CurrentObj = this.Project.GetFCOByID(this.m_CurrentObjId);

            // This can only be a testbench at this point
            ISIS.GME.Dsml.CyPhyML.Interfaces.TestBenchType tb = ISIS.GME.Dsml.CyPhyML.Classes.TestBenchType.Cast(this.CurrentObj as MgaObject);
            this.CallFormulaEvaluator(this.CurrentObj); // FIXME: KMS: For multijobrun, is this necessary?
            avmProj = AVM.DDP.MetaAvmProject.Create(Path.GetDirectoryName(OriginalProjectFileName), Project);
            avmProj.SaveSummaryReportJson(this.OutputDirectory, this.CurrentObj);
            avmProj.SaveTestBenchManifest(this.OutputDirectory, tb, Dependencies);
            avmProj.UpdateResultsJson(this.CurrentObj, this.OutputDirectory);
            // TODO: test bench export??
            }
            finally
            {
                this.Project.AbortTransaction();
            }
            var currentProjectDir = Path.GetDirectoryName(this.Project.ProjectConnStr.Substring("MGA=".Length));
            ComComponent interpreter = new ComComponent(ProgId);


            // Read the copied over configuration (the original one may be changed and/or opened).
            if (interpreter.InterpreterConfig != null)
            {
                interpreter.InterpreterConfig = META.ComComponent.DeserializeConfiguration(currentProjectDir, interpreter.InterpreterConfig.GetType(), interpreter.ProgId);
            }
            
            this.Interpreter = interpreter;

            interpreter.Initialize(Project);

            interpreter.WorkflowParameters = WorkflowParametersDict;
            interpreter.SetWorkflowParameterValues();
            interpreter.MainParameters.OutputDirectory = this.OutputDirectory;
            interpreter.MainParameters.ProjectDirectory = Path.GetDirectoryName(this.OriginalProjectFileName);
            interpreter.MainParameters.ConsoleMessages = false;
            interpreter.MainParameters.Project = Project;
            interpreter.MainParameters.CurrentFCO = CurrentObj;
            interpreter.MainParameters.SelectedFCOs = SelectedObjs;
            interpreter.MainParameters.StartModeParam = ParamInvoke;

            interpreter.Main();

            this.RunCommand = interpreter.result.RunCommand;
            this.Labels = interpreter.result.Labels;
            this.BuildQuery = interpreter.result.BuildQuery;
            this.ResultsZip = interpreter.result.ZippyServerSideHook;

            this.Project.BeginTransaction(terr);
            try
            {
                var manifest = AVM.DDP.MetaTBManifest.OpenForUpdate(this.OutputDirectory);
                manifest.AddAllTasks(ISIS.GME.Dsml.CyPhyML.Classes.TestBenchType.Cast(this.CurrentObj), new ComComponent[] { interpreter });
                manifest.Serialize(this.OutputDirectory);
                // if some magic happens in the test bench and some interpreters would update the model
                // and they are NOT updating the summary file accordingly we will do it here.
                // RISK: if any interpreter wants to update the summary file like CyPython this could mess up the values.
                this.CallFormulaEvaluator(this.CurrentObj);
                avmProj.SaveSummaryReportJson(this.OutputDirectory, this.CurrentObj);
            }
            finally
            {
                this.Project.AbortTransaction();
            }
        }