Ejemplo n.º 1
0
        public void Main()
        {
            if (CurrentObjectRequired == true &&
                MainParameters.CurrentFCO == null)
            {
                throw new InterpreterException("Current object is not set for COM object.");
            }
            if (MgaComponent == null)
            {
                throw new ArgumentNullException("MgaComponent");
            }
            if (MgaComponent is ICyPhyInterpreter)
            {
                MainParameters.config = InterpreterConfig;
                result = ((ICyPhyInterpreter)MgaComponent).Main(MainParameters);
            }
            else
            {
                // set up the interpreter specific parameters
                if (ProgId == "MGA.Decorator.CyPhy2CAD")
                {
                    MgaComponent.ComponentParameter["generateCAD"] = "true";
                }
                MgaComponent.ComponentParameter["automation"]            = "true";
                MgaComponent.ComponentParameter["output_dir"]            = MainParameters.OutputDirectory;
                MgaComponent.ComponentParameter["console_messages"]      = MainParameters.ConsoleMessages ? "on" : "off";
                MgaComponent.ComponentParameter["original_project_file"] = Path.Combine(MainParameters.ProjectDirectory, "fake.mga");
                MgaComponent.ComponentParameter["do_config"]             = "false";

                MgaComponent.InvokeEx(
                    MainParameters.Project,
                    MainParameters.CurrentFCO,
                    MainParameters.SelectedFCOs,
                    MainParameters.StartModeParam);

                InterpreterResult result = new InterpreterResult();
                result.Labels              = MgaComponent.ComponentParameter["labels"] as string;
                result.RunCommand          = MgaComponent.ComponentParameter["runCommand"] as string;
                result.Success             = true;
                result.ZippyServerSideHook = MgaComponent.ComponentParameter["results_zip_py"] as string;
                // FIXME
                result.LogFileDirectory = Path.Combine(MainParameters.ProjectDirectory, "log");
                result.BuildQuery       = MgaComponent.ComponentParameter["build_query"] as string;
                this.result             = result;
            }
            if (this.result.Success == false)
            {
                throw new InterpreterException(this.Name + " execution failed");
            }
        }
Ejemplo n.º 2
0
        public void Initialize(MgaProject Project)
        {
            if (isValid == false)
            {
                return;
            }

            MgaComponent.Enable(true);
            MgaComponent.Initialize(Project);
            MgaComponent.InteractiveMode = true;

            if (MgaComponent is ICyPhyInterpreter)
            {
            }
            else
            {
                // set interpreter specific paramters
                foreach (KeyValuePair <string, string> kvp in WorkflowParameters)
                {
                    MgaComponent.ComponentParameter[kvp.Key] = kvp.Value;
                }
            }
        }