public static void PerformInTransaction(this MgaProject project, MgaGateway.voidDelegate del) { var mgaGateway = new MgaGateway(project); mgaGateway.PerformInTransaction(del, abort: false); }
public IInterpreterResult Main(IInterpreterMainParameters parameters) { result.RunCommand = "runCADJob.bat"; result.Labels = "Creo&&CADCreoParametricCreateAssembly.exev1.4&&" + JobManager.Job.DefaultLabels; var ProjectIsNotInTransaction = (parameters.Project.ProjectStatus & 8) == 0; if (ProjectIsNotInTransaction) { parameters.Project.BeginTransactionInNewTerr(); } Dictionary <string, string> workflowParameters = new Dictionary <string, string>(); var workflowRef = parameters .CurrentFCO .ChildObjects .OfType <MgaReference>() .FirstOrDefault(x => x.Meta.Name == "WorkflowRef"); if (workflowRef != null) { string Parameters = workflowRef.Referred .ChildObjects .OfType <MgaAtom>() .FirstOrDefault(x => x.Meta.Name == "Task") .StrAttrByName["Parameters"]; try { workflowParameters = (Dictionary <string, string>)Newtonsoft.Json.JsonConvert.DeserializeObject(Parameters, typeof(Dictionary <string, string>)); if (workflowParameters == null) { workflowParameters = new Dictionary <string, string>(); } } catch (Newtonsoft.Json.JsonReaderException) { } } META.AnalysisTool.ApplyToolSelection(this.ComponentProgID, workflowParameters, this.result, parameters, modifyLabels: false); if (ProjectIsNotInTransaction) { parameters.Project.AbortTransaction(); } this.CopySTL = workflowParameters.ContainsValue("FreedLinkageAssembler"); var resultzip = CyPhy2CAD_CSharp.Properties.Resources.ResultZip; result.ZippyServerSideHook = Encoding.UTF8.GetString(resultzip); result.LogFileDirectory = Path.Combine(parameters.OutputDirectory, "log"); this.mainParameters = (InterpreterMainParameters)parameters; if (this.mainParameters.config == null) { var config = META.ComComponent.DeserializeConfiguration(this.mainParameters.ProjectDirectory, typeof(CyPhy2CADSettings), this.ComponentProgID) as CyPhy2CADSettings; if (config != null) { this.mainParameters.config = config; settings = config; } else { this.mainParameters.config = new CyPhy2CADSettings(); } } if (this.result.Traceability == null) { this.result.Traceability = new META.MgaTraceability(); } // getting traceability from caller, like master interpreter if (this.mainParameters.Traceability != null) { this.mainParameters.Traceability.CopyTo(this.result.Traceability); } //CyPhy2CAD_CSharp.CyPhy2CADSettings configSettings = (CyPhy2CAD_CSharp.CyPhy2CADSettings)parameters.config; //settings = configSettings; settings = (CyPhy2CAD_CSharp.CyPhy2CADSettings) this.mainParameters.config; settings.OutputDirectory = parameters.OutputDirectory; Automation = true; Logger.Instance.AddLogMessage("Main:Aux Directory is: " + settings.AuxiliaryDirectory, Severity.Info); Logger.Instance.AddLogMessage("Output Directory is: " + settings.OutputDirectory, Severity.Info); MgaGateway.voidDelegate action = delegate { if (Elaborate(parameters.Project, parameters.CurrentFCO, parameters.SelectedFCOs, parameters.StartModeParam)) { result.Success = Main(parameters.Project, parameters.CurrentFCO, parameters.SelectedFCOs, Convert(parameters.StartModeParam)); } else { result.Success = false; Logger.Instance.DumpLog(GMEConsole, LogDir); } }; if ((parameters.Project.ProjectStatus & 8) == 0) { MgaGateway.PerformInTransaction( d: action, mode: transactiontype_enum.TRANSACTION_NON_NESTED, abort: true); } else { action.Invoke(); } return(result); }
private void PerformInTransaction(MgaGateway.voidDelegate del) { var mgaGateway = new MgaGateway(proj); mgaGateway.PerformInTransaction(del, abort: false); }