当前位置: 首页>>代码示例>>C#>>正文


C# MgaFCO类代码示例

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


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


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