本文整理汇总了C#中MgaFCOs类的典型用法代码示例。如果您正苦于以下问题:C# MgaFCOs类的具体用法?C# MgaFCOs怎么用?C# MgaFCOs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MgaFCOs类属于命名空间,在下文中一共展示了MgaFCOs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
}
示例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();
}
}
示例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();
}
示例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.");
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例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();
}
}
示例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);
}
示例11: InvokeEx
public void InvokeEx(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, int param)
{
throw new NotImplementedException(); // Not called by addon
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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);
}
}