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

C# MgaFCO类代码示例

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

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



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

示例1: CheckRule2

 //[CheckerRule("Modelica TB 2", Description = "Description!")]
 //[Tags("Modelica", "Modelica 2")]
 //[ValidContext("Component")]
 public static IEnumerable<RuleFeedbackBase> CheckRule2(MgaFCO context)
 {
     return new List<RuleFeedbackBase>
               {
                   new GenericRuleFeedback{FeedbackType = FeedbackTypes.Warning, Message = "Warning1"},
               };
 }
开发者ID:neemask,项目名称:meta-core,代码行数:10,代码来源:ModelicaTestBench.cs


示例2: CheckRule

        public static IEnumerable<RuleFeedbackBase> CheckRule(MgaFCO context)
        {
            var result = new List<RuleFeedbackBase>();

            CyPhyML.Component cyPhyMLComponent = ISIS.GME.Common.Utils.CreateObject<CyPhyMLClasses.Component>(context as MgaObject);

            Dictionary<string, List<CyPhyML.HasDescriptionAndGUID>> namePPMListMap = new Dictionary<string, List<CyPhyML.HasDescriptionAndGUID> >();

            List<object> objectList = cyPhyMLComponent.AllChildren.ToList<object>();
            foreach( CyPhyML.HasDescriptionAndGUID cyPhyMLHasDescriptionAndGUID in cyPhyMLComponent.AllChildren.
             Where(x => x.GetType().UnderlyingSystemType == typeof(CyPhyMLClasses.Parameter) || x.GetType().UnderlyingSystemType == typeof(CyPhyMLClasses.Property) || x.GetType().UnderlyingSystemType == typeof(CyPhyMLClasses.Metric))
            ) {
                Type type = cyPhyMLHasDescriptionAndGUID.GetType();
                string name = cyPhyMLHasDescriptionAndGUID.Name;
                if (!namePPMListMap.ContainsKey(name)) {
                    namePPMListMap[name] = new List<CyPhyML.HasDescriptionAndGUID>();
                }
                namePPMListMap[name].Add(cyPhyMLHasDescriptionAndGUID);
            }

            foreach (string name in namePPMListMap.Keys) {
                List<CyPhyML.HasDescriptionAndGUID> ppmList = namePPMListMap[name];
                if (ppmList.Count > 1) {
                    var genericRuleFeedback = new GenericRuleFeedback() {
                        FeedbackType = FeedbackTypes.Error,
                        Message = "Name \"" + name + "\" not unique between Parameter, Property, and Metric children of Component \"" + cyPhyMLComponent.Name + "\""
                    };
                    result.Add(genericRuleFeedback);
                }
            }
            return result;
        }
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:32,代码来源:UniquePPMNames.cs


示例3: 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


示例4: Create

 public CyPhy.Parameter Create(MgaFCO parent)
 {
     if (typeof(CyPhy.CFDTestBench).Name == parent.MetaBase.Name)
     {
         return Create(CyPhyClasses.CFDTestBench.Cast(parent));
     }
     else if (typeof(CyPhy.TestBench).Name == parent.MetaBase.Name)
     {
         return Create(CyPhyClasses.TestBench.Cast(parent));
     }
     else if (typeof(CyPhy.CADTestBench).Name == parent.MetaBase.Name)
     {
         return Create(CyPhyClasses.CADTestBench.Cast(parent));
     }
     else if (typeof(CyPhy.BallisticTestBench).Name == parent.MetaBase.Name)
     {
         return Create(CyPhyClasses.BallisticTestBench.Cast(parent));
     }
     else if (typeof(CyPhy.BlastTestBench).Name == parent.MetaBase.Name)
     {
         return Create(CyPhyClasses.BlastTestBench.Cast(parent));
     }
     else if (typeof(CyPhy.ComponentAssembly).Name == parent.MetaBase.Name)
     {
         return Create(CyPhyClasses.ComponentAssembly.Cast(parent));
     }
     else if (typeof(CyPhy.Component).Name == parent.MetaBase.Name)
     {
         return Create(CyPhyClasses.Component.Cast(parent));
     }
     else
     {
         throw new ArgumentException("Can't create parameter for " + parent.MetaBase.Name);
     }
 }
开发者ID:neemask,项目名称:meta-core,代码行数:35,代码来源:ConfigurationParameterTemplate.cs


示例5: RunUdmInterpreter

        public static void RunUdmInterpreter(MgaFCO currentobj, String ProgID)
        {
            // create interpreter type
            Type typeUdmInterpreter = Type.GetTypeFromProgID(ProgID);
            IMgaComponentEx udmInterpreter = Activator.CreateInstance(typeUdmInterpreter) as IMgaComponentEx;

            // empty selected object set
            Type typeMgaFCOs = Type.GetTypeFromProgID("Mga.MgaFCOs");
            MgaFCOs selectedObjs = Activator.CreateInstance(typeMgaFCOs) as MgaFCOs;

            // initialize interpreter
            udmInterpreter.Initialize(currentobj.Project);

            // automation means no UI element shall be shown by the interpreter
            udmInterpreter.ComponentParameter["automation"] = "true";

            // do not write to the console
            udmInterpreter.ComponentParameter["console_messages"] = "off";

            // do not expand nor collapse the model
            udmInterpreter.ComponentParameter["expanded"] = "true";

            // call the formula evaluator and update all parameters starting from the current object
            udmInterpreter.InvokeEx(currentobj.Project, currentobj, selectedObjs, 16);
        }
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:25,代码来源:Utils.cs


示例6: RunDSRefactorer

        public static void RunDSRefactorer(MgaFCO currentobj, List<MgaFCO> selected, String refactoredType)
        {
            // create interpreter type
            Type typeInterpreter = Type.GetTypeFromProgID("MGA.Interpreter.CyphyDesignSpaceRefactor");
            IMgaComponentEx dsRefactorInterpreter = Activator.CreateInstance(typeInterpreter) as IMgaComponentEx;

            // empty selected object set
            Type typeMgaFCOs = Type.GetTypeFromProgID("Mga.MgaFCOs");
            MgaFCOs selectedObjs = Activator.CreateInstance(typeMgaFCOs) as MgaFCOs;
            foreach (MgaFCO fco in selected)
            {
                selectedObjs.Append(fco);
            }

            // initialize interpreter
            dsRefactorInterpreter.Initialize(currentobj.Project);

            // automation means no UI element shall be shown by the interpreter
            dsRefactorInterpreter.ComponentParameter["automation"] = "true";
            dsRefactorInterpreter.ComponentParameter["refactored_type_or_action"] = refactoredType;

            // do not write to the console
            dsRefactorInterpreter.ComponentParameter["console_messages"] = "off";

            // do not expand nor collapse the model
            dsRefactorInterpreter.ComponentParameter["expanded"] = "true";

            // call the formula evaluator and update all parameters starting from the current object
            dsRefactorInterpreter.InvokeEx(currentobj.Project, currentobj, selectedObjs, 16);
        }
开发者ID:neemask,项目名称:meta-core,代码行数:30,代码来源:Utils.cs


示例7: 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


示例8: 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


示例9: 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


示例10: OneAndOnlyOneDriver

        public static IEnumerable<RuleFeedbackBase> OneAndOnlyOneDriver(MgaFCO context)
        {
            var result = new List<RuleFeedbackBase>();

            var pet = CyPhyClasses.ParametricExploration.Cast(context);

            var cnt = pet.Children.ParameterStudyCollection.Count() +
                pet.Children.PCCDriverCollection.Count() +
                pet.Children.OptimizerCollection.Count();

            if (cnt < 1)
            {
                var feedback = new GenericRuleFeedback()
                {
                    FeedbackType = FeedbackTypes.Error,
                    Message = string.Format("No driver defined, please add either a PCCDriver, Parameter Study or Optimizer.")
                };

                result.Add(feedback);
            }
            else if (cnt > 1)
            {
                var feedback = new GenericRuleFeedback()
                {
                    FeedbackType = FeedbackTypes.Error,
                    Message = string.Format("The ParameterExploration-model has {0} drivers. There must only be one.", cnt)
                };

                result.Add(feedback);
            }

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


示例11: VisitConnector

        private void VisitConnector(CyPhy.Connector connector, MgaFCO parent)
        { 
            if (!visitedPorts.Contains(connector.ID + "_" + parent.ID))
            {
                visitedPorts.Add(connector.ID + "_" + parent.ID);
                
                bool parentIsComponent = (connector.ParentContainer is CyPhy.Component);
                bool isStart = (connector.ID == startNodeID);

                if (!isStart && parentIsComponent)
                {
                    FoundConnectedNodes.Add(connector);
                }

                foreach (CyPhy.ConnectorComposition conn in connector.SrcConnections.ConnectorCompositionCollection)
                {
                    if (topAssembly != null && !IsParent(conn, topAssembly)) continue;
                    if (parent.ObjType != GME.MGA.Meta.objtype_enum.OBJTYPE_REFERENCE ||
                        GetRefportOrParent((MgaConnection) conn.Impl, "src").ID == parent.ID)
                        VisitConnector(conn.SrcEnds.Connector, parent);
                }

                foreach (CyPhy.ConnectorComposition conn in connector.DstConnections.ConnectorCompositionCollection)
                {
                    if (topAssembly != null && !IsParent(conn, topAssembly)) continue;
                    if (parent.ObjType != GME.MGA.Meta.objtype_enum.OBJTYPE_REFERENCE ||
                        GetRefportOrParent((MgaConnection)conn.Impl, "dst").ID == parent.ID)
                    VisitConnector(conn.DstEnds.Connector, parent);
                }                 
                
            }
        }
开发者ID:neemask,项目名称:meta-core,代码行数:32,代码来源:CommonTraversal.cs


示例12: CheckRule1

 //[CheckerRule("Modelica TB", Description = "Description is not mandatory.")]
 //[Tags("Modelica","Modelica 2")]
 //[ValidContext("AggregatePort")]
 public static IEnumerable<RuleFeedbackBase> CheckRule1(MgaFCO context)
 {
     return new List<RuleFeedbackBase>
               {
                   new GenericRuleFeedback{FeedbackType = FeedbackTypes.Error, Message = "Error1"},
                   new GenericRuleFeedback{FeedbackType = FeedbackTypes.Error, Message = "Error2"},
                   new GenericRuleFeedback{FeedbackType = FeedbackTypes.Error, Message = "Error3"},
               };
 }
开发者ID:neemask,项目名称:meta-core,代码行数:12,代码来源:ModelicaTestBench.cs


示例13: CheckTLSUT

        public static IEnumerable<RuleFeedbackBase> CheckTLSUT(MgaFCO context)
        {
            var result = new List<RuleFeedbackBase>();

            var tsults = context.ChildObjects.OfType<MgaReference>().Where(x => x.Meta.Name == "TopLevelSystemUnderTest");

            var count = tsults.Count();

            if (count == 0)
            {
                var feedback = new GenericRuleFeedback()
                {
                    FeedbackType = FeedbackTypes.Error,
                    Message = "There is no top level system under test object."
                };

                result.Add(feedback);
            }
            else if (count == 1)
            {
                var referred = tsults.FirstOrDefault().Referred;
                if (referred == null)
                {
                    var feedback = new GenericRuleFeedback()
                    {
                        FeedbackType = FeedbackTypes.Error,
                        Message = "Top level system under test reference cannot be null."
                    };

                    result.Add(feedback);
                }
                else if (referred.Meta.Name != "DesignContainer")
                {
                    var feedback = new GenericRuleFeedback
                                       {
                        FeedbackType = FeedbackTypes.Warning,
                        Message = "Top level system under test reference MUST point to a Design Container."
                    };

                    result.Add(feedback);
                }
            }
            else
            {
                var feedback = new GenericRuleFeedback
                                   {
                    FeedbackType = FeedbackTypes.Error,
                    Message = "There is more than one top level system under test object."
                };

                result.Add(feedback);
            }

            return result;
        }
开发者ID:neemask,项目名称:meta-core,代码行数:55,代码来源:ModelicaTestBench.cs


示例14: SoTObjectsValid

        public static IEnumerable<RuleFeedbackBase> SoTObjectsValid(MgaFCO context)
        {
            try
            {
                var result = new List<RuleFeedbackBase>();

                // check for unsupported object types
                var unsupportedKinds = new List<string>();
                unsupportedKinds.AddRange(new string[] { typeof(CyPhy.TopLevelSystemUnderTest).Name });

                var fcos = (context as MgaModel)
                    .ChildObjects
                    .Cast<MgaFCO>()
                    .Where(x => unsupportedKinds.Contains(x.Meta.Name));

                foreach (var item in fcos)
                {
                    var feedback = new GenericRuleFeedback()
                    {
                        FeedbackType = FeedbackTypes.Error,
                        Message = string.Format("Context: {0} - {1}[{2}] is not supported",
                            context.Name,
                            item.Name,
                            item.Meta.Name)
                    };

                    feedback.InvolvedObjectsByRole.Add(context as IMgaFCO);
                    result.Add(feedback);
                }

                return result; 
            }
            catch (Exception ex)
            {
                var result = new List<RuleFeedbackBase>();

                var feedback = new GenericRuleFeedback()
                {
                    FeedbackType = FeedbackTypes.Error,
                    Message = string.Format("Context: {0} - Exception: {1} {2}",
                        context.Name,
                        ex.Message,
                        ex.StackTrace)
                };

                feedback.InvolvedObjectsByRole.Add(context);
                result.Add(feedback);

                return result;
            }
        }
开发者ID:neemask,项目名称:meta-core,代码行数:51,代码来源:Global.cs


示例15: 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


示例16: 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


示例17: 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


示例18: Run

        public static bool Run(string outputdirname, MgaProject project, MgaFCO testObj, bool copycomponents)
        {
            bool status = true;
            try
            {

                if (copycomponents)
                {
                    CopyDirectory(Path.Combine(GetProjectDir(project),"components"), Path.Combine(outputdirname, "components"));
                }

                var interpreter = new CyPhy2CAD_CSharp.CyPhy2CAD_CSharpInterpreter();
                interpreter.Initialize(project);

                var mainParameters = new CyPhyGUIs.InterpreterMainParameters();
                var cadSettings = new CyPhy2CAD_CSharp.CyPhy2CADSettings();
                cadSettings.OutputDirectory = outputdirname;
                cadSettings.AuxiliaryDirectory = "";
                mainParameters.config = cadSettings;
                mainParameters.Project = project;
                mainParameters.CurrentFCO = testObj;
                mainParameters.SelectedFCOs = (MgaFCOs)Activator.CreateInstance(Type.GetTypeFromProgID("Mga.MgaFCOs"));
                mainParameters.StartModeParam = 128;
                mainParameters.ConsoleMessages = false;
                mainParameters.ProjectDirectory = Path.GetDirectoryName(GetProjectDir(project));
                mainParameters.OutputDirectory = outputdirname;

                interpreter.Main(mainParameters);
            }
            catch (Exception)
            {
                status = false;
            }
            finally
            {
                project.Close();
            }

            return status;

        }
开发者ID:neemask,项目名称:meta-core,代码行数:41,代码来源:CyPhy2CADRun.cs


示例19: ManufacturingGeneration

        private void ManufacturingGeneration(MgaFCO currentobj)
        {
            if (currentobj.MetaBase.Name == "TestBench")
            {
                // DDP Generation
                CyPhy.TestBench tb = CyPhyClasses.TestBench.Cast(currentobj);
                var catlsut = tb.Children.ComponentAssemblyCollection.FirstOrDefault();     // should be an instance b/c elaborate was called earlier
                if (catlsut == null)
                {
                    throw new Exception("There is no elaborated system under test component assembly in the model!");
                }

                var design = CyPhy2DesignInterchange.CyPhy2DesignInterchange.Convert(catlsut);
                this.TestBenchName = tb.Name;
                this.AssemblyName = design.Name;
                design.SaveToFile(Path.Combine(this.OutputDirectory, this.TestBenchName + ".adm"));

                if (catlsut.Attributes.ConfigurationUniqueID.Contains("{"))
                    this.ManufacturingManifestData.DesignID = catlsut.Attributes.ConfigurationUniqueID;
                else
                    this.ManufacturingManifestData.DesignID = "{" + catlsut.Attributes.ConfigurationUniqueID + "}";
                this.ManufacturingManifestData.Name = catlsut.Name;
                PartManufacturingGeneration(catlsut);
            }
            else if (currentobj.MetaBase.Name == "ComponentAssembly")
            {
                // DDP Generation
                CyPhy.ComponentAssembly assembly = CyPhyClasses.ComponentAssembly.Cast(currentobj);

                var design = CyPhy2DesignInterchange.CyPhy2DesignInterchange.Convert(assembly);
                this.AssemblyName = design.Name;
                this.TestBenchName = design.Name;
                design.SaveToFile(Path.Combine(this.OutputDirectory, this.TestBenchName + ".adm"));

                this.ManufacturingManifestData.DesignID = "{" + assembly.Attributes.ConfigurationUniqueID + "}";
                this.ManufacturingManifestData.Name = assembly.Name;
                PartManufacturingGeneration(assembly);
            }
            else
                throw new NotImplementedException();
        }
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:41,代码来源:CyPhyPrepareIFab_Traverse.cs


示例20: 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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# MgaFCOs类代码示例发布时间:2022-05-24
下一篇:
C# MgResourceIdentifier类代码示例发布时间: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