private CyPhyML.ComponentAssembly Run(MgaProject project, MgaFCO currentobj, int param) { CyPhyML.ComponentAssembly topasm = null; if (currentobj == null || currentobj.MetaBase.Name != "ComponentAssembly") { MessageBox.Show("Please open an assembly!"); return topasm; } // [1] Find top-level assembly // [2] Create folder name // [3] MainFrame // [4] CyPhy2CAD_CSharp // [1] topasm = FindTopLevelAssembly(CyPhyMLClasses.ComponentAssembly.Cast(currentobj)); if (topasm == null) { return topasm; } #if DEBUG if (topasm != null) { GMEConsole.Out.WriteLine("TopAsm:" + topasm.Name); } #endif ProjectDirectory = Path.GetDirectoryName(currentobj.Project.ProjectConnStr.Substring("MGA=".Length)); string workingDir = "MetaLink_" + DateTime.Now.ToString("MMddHHmmss"); CyPhyMetaLink.SyncedComponentData cdata = new CyPhyMetaLink.SyncedComponentData() { Type = SyncedComponentData.EditType.Design, WorkingDir = Path.Combine(ProjectDirectory, workingDir), Id = topasm.Guid.ToString(), InstanceId = (CyPhyMetaLinkAddon.IdCounter++).ToString() }; if (!Directory.Exists(cdata.WorkingDir)) { Directory.CreateDirectory(cdata.WorkingDir); } // [3] DialogResult ok = DialogResult.Cancel; if (param != 128) { using (MainForm mf = new MainForm(cdata.WorkingDir)) { ok = mf.ShowDialog(); cdata.AuxDir = mf.AuxiliaryDir; if (ok != DialogResult.OK) { return null; } } } propagateAddon.syncedComponents.Add(cdata.Id, cdata); return topasm; }
private CyPhyML.ComponentAssembly Run(MgaProject project, MgaFCO currentobj, int param) { CyPhyML.ComponentAssembly topasm = null; if (currentobj == null || currentobj.MetaBase.Name != "ComponentAssembly") { MessageBox.Show("Please open an assembly!"); return(topasm); } // [1] Find top-level assembly // [2] Create folder name // [3] MainFrame // [4] CyPhy2CAD_CSharp // [1] topasm = FindTopLevelAssembly(CyPhyMLClasses.ComponentAssembly.Cast(currentobj)); if (topasm == null) { return(topasm); } #if DEBUG if (topasm != null) { GMEConsole.Out.WriteLine("TopAsm:" + topasm.Name); } #endif string workingDir = "MetaLink_" + DateTime.Now.ToString("MMddHHmmss"); CyPhyMetaLink.SyncedComponentData cdata = new CyPhyMetaLink.SyncedComponentData() { Type = SyncedComponentData.EditType.Design, WorkingDir = Path.Combine(ProjectDirectory, "metalink", workingDir), Id = topasm.Guid.ToString(), InstanceId = (CyPhyMetaLinkAddon.IdCounter++).ToString() }; if (!Directory.Exists(cdata.WorkingDir)) { Directory.CreateDirectory(cdata.WorkingDir); } // [3] DialogResult ok = DialogResult.Cancel; if (param != 128) { using (MainForm mf = new MainForm(cdata.WorkingDir)) { ok = mf.ShowDialog(); cdata.AuxDir = mf.AuxiliaryDir; if (ok != DialogResult.OK) { return(null); } } } metalinkAddon.syncedComponents.Add(cdata.Id, cdata); return(topasm); }