• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MgaFCOs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MgaFCOs的典型用法代码示例。如果您正苦于以下问题:C# MgaFCOs类的具体用法?C# MgaFCOs怎么用?C# MgaFCOs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MgaFCOs类属于命名空间,在下文中一共展示了MgaFCOs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Main

        public void Main(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, ComponentStartMode startMode)
        {
            this.Logger.WriteInfo("Running Component Authoring interpreter.");

            // verify we are running in a component and that it is not an instance or library
            string return_msg;
            if (!CheckPreConditions(currentobj, out return_msg))
            {
                this.Logger.WriteFailed(return_msg);
                return;
            }

            // assuming a component is open
            // stash off the project, currentobj and CurrentComponent parameters for use in the event handlers
            StashProject = project;
            StashCurrentObj = currentobj;
            StashCurrentComponent = CyPhyClasses.Component.Cast(currentobj);

            // use reflection to populate the dialog box objects
            PopulateDialogBox();

            // To use the domain-specific API:
            //  Create another project with the same name as the paradigm name
            //  Copy the paradigm .mga file to the directory containing the new project
            //  In the new project, install the GME DSMLGenerator NuGet package (search for DSMLGenerator)
            //  Add a Reference in this project to the other project
            //  Add "using [ParadigmName] = ISIS.GME.Dsml.[ParadigmName].Classes.Interfaces;" to the top of this file
            // if (currentobj.Meta.Name == "KindName")
            // [ParadigmName].[KindName] dsCurrentObj = ISIS.GME.Dsml.[ParadigmName].Classes.[KindName].Cast(currentobj);			
        }
开发者ID:metamorph-inc,项目名称:meta-core,代码行数:30,代码来源:CyPhyComponentAuthoring.cs


示例2: Main

        public void Main(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, ComponentStartMode startMode)
        {
            // TODO: Add your interpreter code
            gmeConsole.Out.WriteLine("Running Subtree Merge Utility ...");

            string[] FileNames = null;
            DialogResult dr;
            using (OpenFileDialog ofd = new OpenFileDialog()) {
                ofd.CheckFileExists = true;
                ofd.DefaultExt = "mga";
                ofd.Multiselect = false;
                ofd.Filter = "mga files (*.mga)|*.mga|All files (*.*)|*.*";

                dr = ofd.ShowDialog();
                if (dr == DialogResult.OK) {
                    FileNames = ofd.FileNames;
                }
            }
            if (dr == DialogResult.OK) {
                MgaGateway.PerformInTransaction(delegate {
                    SubTreeMerge subTreeMerge = new SubTreeMerge();
                    subTreeMerge.gmeConsole = gmeConsole;
                    subTreeMerge.merge(currentobj, FileNames[0]);
                }, transactiontype_enum.TRANSACTION_NON_NESTED, abort: false);
                return;
            } else {
                gmeConsole.Warning.WriteLine("Subtree Merge Utility cancelled");
                return;
            }
        }
开发者ID:metamorph-inc,项目名称:meta-core,代码行数:30,代码来源:SubTreeMerge.cs


示例3: InvokeEx

        public void InvokeEx(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, int param)
        {
            if (!enabled)
            {
                return;
            }

            try
            {
                GMEConsole = GMEConsole.CreateFromProject(project);
                MgaGateway = new MgaGateway(project);
                project.CreateTerritoryWithoutSink(out MgaGateway.territory);

                MgaGateway.PerformInTransaction(delegate
                {
                    Main(project, currentobj, selectedobjs, Convert(param));
                },
                abort: true);
            }
            finally
            {
                if (MgaGateway.territory != null)
                {
                    MgaGateway.territory.Destroy();
                }
                MgaGateway = null;
                project = null;
                currentobj = null;
                selectedobjs = null;
                GMEConsole = null;
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
        }
开发者ID:neemask,项目名称:meta-core,代码行数:34,代码来源:DesignConsistencyChecker.cs


示例4: Main

 public void Main(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, ComponentStartMode startMode)
 {
     // create a checker instance
     var ch = new Framework.Checker(currentobj, project, null);
     var checkerWindow = new RuleView(ch);
     checkerWindow.ShowDialog();
 }
开发者ID:neemask,项目名称:meta-core,代码行数:7,代码来源:DesignConsistencyChecker.cs


示例5: InvokeEx2

        public void InvokeEx2(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, int param)
        {
            string projectPath = Path.GetDirectoryName(project.ProjectConnStr.Substring(4)); // skip mga=
            string projectName = Path.GetFileNameWithoutExtension(project.ProjectConnStr.Substring(4));
            string cyphyFilename = project.ProjectConnStr.Substring(4);
            baseOutputDir = Path.Combine(projectPath, projectName + "_PRISMATIC");
            GME.CSharp.GMEConsole console = GME.CSharp.GMEConsole.CreateFromProject(project);
            console.Out.WriteLine("Output directory is " + baseOutputDir);

            META_PATH = GetMetaPathValue();
            if (!Directory.Exists(META_PATH))
            {
                throw new ApplicationException("META_PATH='" + META_PATH + "' doesn't exist. Please install the META toolchain and restart GME.");
            }

            string metaPath = Path.Combine( META_PATH, "meta" );
            if (!Directory.Exists(metaPath))
            {
                throw new ApplicationException(metaPath + " doesn't exist");
            }

            ensureDir(baseOutputDir);

            string CyPhyML_udm_xml_path = Path.Combine(metaPath, "CyPhyML_udm.xml");
            if (!File.Exists(CyPhyML_udm_xml_path))
            {
                CyPhyML_udm_xml_path = Path.Combine(metaPath, @"..\generated\CyPhyML\models\CyPhyML_udm.xml");
            }
            string CyPhyML_xsd_path = Path.Combine(metaPath, "CyPhyML.xsd");
            if (!File.Exists(CyPhyML_xsd_path))
            {
                CyPhyML_xsd_path = Path.Combine(metaPath, @"..\generated\CyPhyML.xsd");
            }


            console.Out.WriteLine("Extracting XML model...");
            runProgram( Path.Combine(metaPath, @"..\bin\UdmCopy.exe"), new string[] { 
                "-f",
                cyphyFilename, 
                Path.Combine( baseOutputDir, projectName + ".xml" ), 
                CyPhyML_udm_xml_path, 
                CyPhyML_xsd_path } );

            console.Out.WriteLine("Generating Prismatic files...");
            runProgram( "C:\\Python26\\python.exe", new string[] { META_PATH + "\\bin\\Prismatic\\" + "cmc.py", Path.Combine( baseOutputDir, projectName + ".xml" ), baseOutputDir } );
            console.Out.WriteLine("Running Prismatic...");
            runProgram( "C:\\Python27\\python.exe", new string[] { baseOutputDir + "\\prismatic.py" });
            console.Out.WriteLine("Prismatic work done.");
        }
开发者ID:neemask,项目名称:meta-core,代码行数:49,代码来源:Run_Prismatic_toolchain.cs


示例6: Main

        public void Main(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, ComponentStartMode startMode)
        {
            string[] fileNames = null;
            DialogResult dr;
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                ofd.CheckFileExists = true;
                ofd.DefaultExt = "design.adm";
                ofd.Multiselect = true;
                ofd.Filter = "AVM design files (*.adm)|*.adm|All files (*.*)|*.*";
                ofd.RestoreDirectory = true;
                if (project.ProjectConnStr.StartsWith("MGA=", true, System.Globalization.CultureInfo.InvariantCulture))
                {
                    ofd.InitialDirectory = Path.GetDirectoryName(project.ProjectConnStr.Substring("MGA=".Length));
                }

                dr = ofd.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    fileNames = ofd.FileNames;
                }
            }
            if (dr == DialogResult.OK)
            {
                Model[] result = null;
                MgaGateway.PerformInTransaction(delegate
                {
                    var importer = new AVMDesignImporter(GMEConsole, project);
                    result  = importer.ImportFiles(fileNames, mode: AVMDesignImporter.DesignImportMode.CREATE_CA_IF_NO_DS_CONCEPTS);
                }, transactiontype_enum.TRANSACTION_NON_NESTED, abort: false);

                if (result.Length > 0 && GMEConsole.gme != null)
                {
                    GMEConsole.gme.ShowFCO((MgaFCO)result[0].Impl);
                }
                return;
            }
            else
            {
                GMEConsole.Warning.WriteLine("Design Importer canceled");
                return;
            }
        }
开发者ID:metamorph-inc,项目名称:meta-core,代码行数:43,代码来源:CyPhyDesignImporterInterpreter.cs


示例7: Main

        public void Main(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, ComponentStartMode startMode)
        {
            string[] fileNames = null;
            DialogResult dr;
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                ofd.CheckFileExists = true;
                ofd.DefaultExt = "testbench.atm";
                ofd.Multiselect = true;
                ofd.Filter = "AVM testbench files (*.atm)|*.atm|All files (*.*)|*.*";

                dr = ofd.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    fileNames = ofd.FileNames;
                }
            }
            if (dr == DialogResult.OK)
            {
                MgaGateway.PerformInTransaction(delegate
                {
                    foreach (var fileName in fileNames)
                    {
                        using (var streamReader = new StreamReader(fileName))
                        {
                            var avmTestBench = XSD2CSharp.AvmXmlSerializer.Deserialize<avm.TestBench>(streamReader);
                            CyPhy2TestBenchInterchange.TestBenchInterchange2CyPhy.Convert(avmTestBench, project);
                        }
                    }
                }, transactiontype_enum.TRANSACTION_NON_NESTED, abort: false);

                //if (result.Any() && GMEConsole.gme != null)
                //{
                //    GMEConsole.gme.ShowFCO((MgaFCO)result.First().Impl);
                //}
                return;
            }
            else
            {
                GMEConsole.Warning.WriteLine("TestBench Importer canceled");
                return;
            }		
        }
开发者ID:metamorph-inc,项目名称:meta-core,代码行数:43,代码来源:CyPhyTestBenchImporter.cs


示例8: Main

        public void Main(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, ComponentStartMode startMode)
        {
            string OutputBaseDir = (string)componentParameters["output_dir"];

            SotConfig sotConfig = new SotConfig();
            sotConfig.MultiJobRun = true;
            sotConfig.OriginalProjectFileName = project.ProjectConnStr.Substring("MGA=".Length);
            sotConfig.ProjectFileName = Path.Combine(OutputBaseDir, Path.GetFileName(sotConfig.OriginalProjectFileName));
            // can't be in a tx and save the project
            project.AbortTransaction();
            project.Save("MGA=" + sotConfig.ProjectFileName, true);
            project.BeginTransactionInNewTerr(transactiontype_enum.TRANSACTION_NON_NESTED);
            MgaGateway.PerformInTransaction(delegate
            {
                sotConfig.SoTID = currentobj.ID;
            }, transactiontype_enum.TRANSACTION_READ_ONLY);
            using (StreamWriter writer = new StreamWriter(Path.Combine(OutputBaseDir, "manifest.sot.json")))
            {
                writer.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(sotConfig, Newtonsoft.Json.Formatting.Indented));
            }

            string configsDir = Path.Combine(Path.GetDirectoryName((string)componentParameters["original_project_file"]), "config");
            if (Directory.Exists(configsDir))
            {
                var configs = Directory.EnumerateFiles(configsDir, "*xml").ToList();
                string sotConfigDir = Path.Combine(OutputBaseDir, "config");
                Directory.CreateDirectory(sotConfigDir);
                foreach (var config in configs)
                {
                    File.Copy(config, Path.Combine(sotConfigDir, Path.GetFileName(config)));
                }
            }

            //componentParameters["labels"] = "";
            //componentParameters["runCommand"] = ;
            //componentParameters["results_zip_py"] as string;
            // result.LogFileDirectory = Path.Combine(MainParameters.ProjectDirectory, "log");
            // componentParameters["build_query"] as string;

        }
开发者ID:metamorph-inc,项目名称:meta-core,代码行数:40,代码来源:CyPhyMultiJobRun.cs


示例9: InvokeEx

        public void InvokeEx(MgaProject project,
                            MgaFCO currentobj,
                            MgaFCOs selectedobjs,
                            int param)
        {
            if (!enabled)
            {
                return;
            }

            try
            {
                GMEConsole = GMEConsole.CreateFromProject(project);
                MgaGateway = new MgaGateway(project);
                this.Logger = new CyPhyGUIs.GMELogger(project, this.ComponentName);

                if (currentobj == null)
                {
                    this.Logger.WriteError("Invalid context. This interpreter can only be run if open in the correct context (E.g., test bench).");
                    return;
                }

                GMEConsole.Out.WriteLine(DateTime.Now.ToString() + " running CyPhyPrepIFab Interpreter");

                //InitLogger();

                // [1] CyPhy2CAD                                 
                // [2] Export DDP, Manufacture XML, Manufacture Manifest
                // [3] Generate AppendArtifact.py - script to append artifacts to testbench_manifest.json files
                // [4] Generate DesignModel1BOM.py - script to generate .bom.json from ddp file
                // [5] Generate main run bat file

                //CallCAD(project, currentobj, selectedobjs, param);                              // CyPhy2CAD                  
                MgaGateway.PerformInTransaction(delegate
                {
                    string kindName = string.Empty;
                    if (currentobj != null)
                    {
                        kindName = currentobj.MetaBase.Name;
                    }

                    if (string.IsNullOrEmpty(kindName) == false && kindName != typeof(CyPhyClasses.TestBench).Name)
                    {
                        Logger.WriteFailed("CyPhyPrepIFAB must be called from a TestBench.");
                        return;
                    }

                    ElaborateModel(project, currentobj, selectedobjs, param);                       // elaborate model        
                    CallCAD(project, currentobj, selectedobjs, param);                              // CyPhy2CAD
                    ManufacturingGeneration(currentobj);                                            // DDP, Manufacture XML, Manufacture Manifest

                },
                transactiontype_enum.TRANSACTION_NON_NESTED);


                GenerateAppendArtifactScript();                                                     // AppendArtifact.py                                               
                GenerateBOMGenScript();                                                             // DesignModel1BOM.py                                                 
                GenerateRunBatFile();                                                               // main run bat file                                            

                GMEConsole.Out.WriteLine("CyPhyPrepIFab Interpreter Finished!");
            }
            catch (Exception)
            {
                Logger.WriteError("{0} has finished with critical errors. Please see above.", this.ComponentName);   
            }

            finally
            {
                //Trace.Close();
                MgaGateway = null;
                if (Logger != null) Logger.Dispose();
                project = null;
                currentobj = null;
                selectedobjs = null;
                GMEConsole = null;
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
        }
开发者ID:metamorph-inc,项目名称:meta-core,代码行数:79,代码来源:CyPhyPrepareIFab.cs


示例10: ElaborateModel

        private void ElaborateModel(MgaProject project,
                                    MgaFCO currentobj,
                                    MgaFCOs selectedobjs,
                                    int param)
        {
            // call elaborator and expand the references
            Type t = Type.GetTypeFromProgID("MGA.Interpreter.CyPhyElaborate");
            IMgaComponentEx elaborator = Activator.CreateInstance(t) as IMgaComponentEx;
            elaborator.Initialize(project);
            elaborator.ComponentParameter["automated_expand"] = "true";
            elaborator.ComponentParameter["console_messages"] = "off";

            elaborator.InvokeEx(project, currentobj, selectedobjs, param);
        }
开发者ID:metamorph-inc,项目名称:meta-core,代码行数:14,代码来源:CyPhyPrepareIFab.cs


示例11: InvokeEx

 public void InvokeEx(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, int param)
 {
     throw new NotImplementedException(); // Not called by addon
 }
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:4,代码来源:CyPhyMdaoAddOn.cs


示例12: InvokeEx

        public void InvokeEx(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, int param)
        {
            if (!enabled)
            {
                return;
            }

            try
            {
                Main(project, currentobj, selectedobjs, Convert(param));
            }
            finally
            {
                MgaGateway = null;
                project = null;
                currentobj = null;
                selectedobjs = null;
                GMEConsole = null;
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
        }
开发者ID:metamorph-inc,项目名称:meta-core,代码行数:22,代码来源:CyPhyComponentImporter.cs


示例13: InvokeEx

        public void InvokeEx(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, int param)
        {
            if (!enabled)
            {
                return;
            }

            try
            {
                MgaGateway = new MgaGateway(project);
                project.CreateTerritoryWithoutSink(out MgaGateway.territory);
                this.Logger = new CyPhyGUIs.GMELogger(project, this.GetType().Name);

                MgaGateway.PerformInTransaction(delegate
                {
                    Main(project, currentobj, selectedobjs, Convert(param));
                });
            }
            finally
            {
                if (Logger != null)
                {
                    Logger.Dispose();
                }
                if (MgaGateway.territory != null)
                {
                    MgaGateway.territory.Destroy();
                }
                MgaGateway = null;
                Logger = null;
                project = null;
                currentobj = null;
                selectedobjs = null;
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
        }
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:37,代码来源:CyPhyComponentAuthoring.cs


示例14: Main

        public void Main(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, ComponentStartMode startMode)
        {
            string projroot = Path.GetDirectoryName(project.ProjectConnStr.Substring("MGA=".Length));

            // TODO: Add your interpreter code
            Logger.WriteInfo("Running {0}...", this.ComponentName);

            string[] FileNames = null;
            DialogResult dr;
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                ofd.CheckFileExists = true;
                ofd.DefaultExt = "component.acm";
                ofd.Multiselect = true;
                ofd.Filter = "component files (*.acm;*.component.acm;*.zip)|*.acm;*.component.acm;*.zip|All files (*.*)|*.*";

                dr = ofd.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    FileNames = ofd.FileNames;
                }
            }
            if (dr == DialogResult.OK)
            {
                MgaGateway.PerformInTransaction(delegate
                {
                    ImportFiles(project, projroot, FileNames);
                }, transactiontype_enum.TRANSACTION_NON_NESTED);

                Logger.WriteSuccess("{0} complete", this.ComponentName);
            }
            else
            {
                Logger.WriteFailed("Component Importer canceled");
            }
            
            return;
        }
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:38,代码来源:CyPhyComponentImporter.cs


示例15: ElaborateModel

 private void ElaborateModel(MgaProject project,
                             MgaFCO currentobj,
                             MgaFCOs selectedobjs,
                             int param)
 {
     try
     {
         var elaborator = new CyPhyElaborateCS.CyPhyElaborateCSInterpreter();
         elaborator.Logger = new GMELogger(project);
         //elaborator.Logger.AddWriter(Logger.Instance);
         var result = elaborator.RunInTransaction(project, currentobj, selectedobjs, param);
         if (result == false)
         {
             throw new ApplicationException("see elaborator log");
         }
         if (this.result.Traceability == null)
         {
             this.result.Traceability = new META.MgaTraceability();
         }
         if (elaborator.Traceability != null)
         {
             elaborator.Traceability.CopyTo(this.result.Traceability);
         }
     }
     catch (Exception e)
     {
         //Logger.Instance.AddLogMessage("Elaborator exception occurred: " + e.Message, Severity.Error);
         throw new Exception(e.Message);
     }
 }
开发者ID:metamorph-inc,项目名称:meta-core,代码行数:30,代码来源:CyPhyCADAnalysis.cs


示例16: InvokeEx

        public void InvokeEx(
                MgaProject project,
                MgaFCO currentobj,
                MgaFCOs selectedobjs,
                int param)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            if (selectedobjs == null)
            {
                throw new ArgumentNullException("selectedobjs");
            }

            this.InteractiveMode = this.Convert(param) != ComponentStartMode.GME_SILENT_MODE;

            try
            {
                GMEConsole = GMEConsole.CreateFromProject(project);
                MgaGateway = new MgaGateway(project);
                project.CreateTerritoryWithoutSink(out MgaGateway.territory);

                this.GMEConsole.Clear();
                System.Windows.Forms.Application.DoEvents();

                this.InteractiveMode = this.Convert(param) != ComponentStartMode.GME_SILENT_MODE;

                this.Logger = new CyPhyGUIs.GMELogger(project, this.GetType().Name);

                this.Logger.GMEConsoleLoggingLevel = Properties.Settings.Default.bVerboseLogging ?
                    CyPhyGUIs.SmartLogger.MessageType_enum.Debug :
                    CyPhyGUIs.SmartLogger.MessageType_enum.Info;

                //this.Logger.WriteDebug("Hello debug");
                //this.Logger.WriteError("Hello error {0} {1} {2}", 1, "string", true);
                //this.Logger.WriteInfo("Hello info");
                //this.Logger.WriteWarning("Hello WriteWarning");
                //this.Logger.WriteFailed("Hello WriteFailed");
                //this.Logger.WriteSuccess("Hello WriteSuccess");
                //this.Logger.WriteCheckFailed("Hello WriteCheckFailed");
                //this.Logger.WriteCheckPassed("Hello WriteCheckPassed");

                this.Logger.WriteInfo("Master Interpreter 2.0");
                System.Windows.Forms.Application.DoEvents();

                this.Logger.MakeVersionInfoHeader();

                // control was held
                this.Process(currentobj);

                foreach (var filename in this.Logger.LogFilenames)
                {
                    this.Logger.WriteInfo("Log file was generated here: <a href=\"file:///{0}\" target=\"_blank\">{1}</a>", Path.GetDirectoryName(filename), filename);
                }

                this.Logger.WriteInfo("Master Interpreter 2.0 finished");
            }
            finally
            {
                this.Logger.Dispose();
                System.Windows.Forms.Application.DoEvents();

                if (MgaGateway.territory != null)
                {
                    MgaGateway.territory.Destroy();
                }
                MgaGateway = null;
                project = null;
                currentobj = null;
                selectedobjs = null;
                GMEConsole = null;
                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
        }
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:79,代码来源:CyPhyMasterInterpreter.cs


示例17: Invoke

 // Old interface, it is never called for MgaComponentEx interfaces
 public void Invoke(MgaProject Project, MgaFCOs selectedobjs, int param)
 {
 }
开发者ID:neemask,项目名称:meta-core,代码行数:4,代码来源:CyPhyMetaLinkAddon.cs


示例18: Elaborate

        private bool Elaborate(
            MgaProject project,
            MgaFCO currentobj,
            MgaFCOs selectedobjs,
            int param)
        {
            try
            {
                bool Expanded = this.componentParameters[OptionNameIFab] as String == "true";
                if (!Expanded)
                {
                    try
                    {
                        var elaborator = new CyPhyElaborateCS.CyPhyElaborateCSInterpreter();
                        elaborator.Logger = new GMELogger(project);
                        elaborator.Logger.AddWriter(Logger.Instance);
                        var result = elaborator.RunInTransaction(project, currentobj, selectedobjs, param);
                        if (result == false)
                        {
                            throw new ApplicationException("see elaborator log");
                        }
                        if (this.result.Traceability == null)
                        {
                            this.result.Traceability = new META.MgaTraceability();
                        }
                        if (elaborator.Traceability != null)
                        {
                            elaborator.Traceability.CopyTo(this.result.Traceability);
                        }
                    }
                    catch (Exception e)
                    {
                        Logger.Instance.AddLogMessage("Elaborator exception occurred: " + e.Message, Severity.Error);
                        throw new Exception(e.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Instance.AddLogMessage(ex.ToString(), Severity.Error);
                return false;
            }

            return true;
        }
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:45,代码来源:CyPhy2CAD_CSharp.cs


示例19: InvokeEx

        public void InvokeEx(
                            MgaProject project, 
                            MgaFCO currentobj, 
                            MgaFCOs selectedobjs, 
                            int param)
        {
            if (!enabled)
            {
                return;
            }

            if (currentobj == null)
            {
                GMEConsole.Error.WriteLine("Please select a CADTestBench, Ballistic Testbench, FEA Testbench, Blast Testbench or CadAssembly.");
                return;
            }

            string currentWorkDir = System.IO.Directory.GetCurrentDirectory();

            try
            {
                var parameters = new InterpreterMainParameters();
                this.mainParameters = parameters;
                parameters.ProjectDirectory = Path.GetDirectoryName(currentobj.Project.ProjectConnStr.Substring("MGA=".Length));

                FetchSettings();

                // Show UI
                using (MainForm mf = new MainForm(settings))
                {
                    mf.ShowDialog();
                    DialogResult ok = mf.DialogResult;
                    if (ok == DialogResult.OK)
                    {
                        settings = mf.ConfigOptions;
                        parameters.OutputDirectory = settings.OutputDirectory;
                        parameters.config = settings;
                    }
                    else
                    {
                        GMEConsole.Warning.WriteLine("Process was cancelled.");
                        return;
                    }
                }

                SaveSettings();

                MgaGateway.PerformInTransaction(delegate
                {
                    Elaborate(project, currentobj, selectedobjs, param);
                    Main(project, currentobj, selectedobjs, Convert(param));
                },
                abort: true);


            }
            finally
            {
                MgaGateway = null;
                project = null;
                currentobj = null;
                selectedobjs = null;
                GMEConsole = null;
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
        }
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:67,代码来源:CyPhy2CAD_CSharp.cs


示例20: Main

        public bool Main(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, ComponentStartMode startMode)
        {
            // TODO: Add your interpreter code
            //GMEConsole.Clear();
            GMEConsole.Out.WriteLine("Running CyPhy2CAD interpreter...");
			
            // TODO: show how to initialize DSML-generated classes
            // Get RootFolder
            //IMgaFolder rootFolder = project.RootFolder;
            //GMEConsole.Out.WriteLine(rootFolder.Name);


            // Check Model
            // Grab all components
            // Create Intermediate Data Representations
            // Walk representation + find islands
            // Convert to DAG

            try
            {

                // META-1971: ADM + ACM file export for blast + ballistics
                // ACM
                {
                    CallComponentExporter(project, currentobj);
                }
                result.Success = true;
                ProcessCAD(currentobj);
                Logger.Instance.DumpLog(GMEConsole, LogDir);
                GMEConsole.Out.WriteLine("Finished CyPhy2CAD with " + (result.Success ? "success" : "failure"));
                return result.Success;
            }
            catch (Exception ex)
            {
                Logger.Instance.AddLogMessage(ex.Message, Severity.Error);
                Logger.Instance.DumpLog(GMEConsole, LogDir);
                GMEConsole.Out.WriteLine("Finished CyPhy2CAD with failure.");
                return false;
            }
        }
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:40,代码来源:CyPhy2CAD_CSharp.cs



注:本文中的MgaFCOs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MgaProject类代码示例发布时间:2022-05-24
下一篇:
C# MgaFCO类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap