private bool EM3_Run(SystemBackgroundWorker sbw) { sbw.em3_RunInfo = new RunLogger.RunInfo(); DateTime startTime = DateTime.Now; bool success = new EM_Executable.Control().Run(sbw.config, progressInfo => { if (sbw.em3_Cancel) { return(false); } sbw.em3_RunInfo.ExtractOutputFiles(progressInfo.detailedInfo); return(true); }, errorInfo => { if (!IsParModError(errorInfo.message)) { sbw.em3_RunInfo.errorInfo.Add(errorInfo); } }); sbw.em3_RunInfo.duration = new RunLogger.Duration(startTime, DateTime.Now); sbw.em3_RunInfo.finishStatus = success ? RunLogger.RunInfo.FINISH_STATUS.finished : RunLogger.RunInfo.FINISH_STATUS.aborted; sbw.em3_RunInfo.ExtractAddonSystemNames(sbw.config, TAGS.CONFIG_ADDON); sbw.em3_RunInfo.extensionSwitches.Add("All Extension Switches", "default-settings"); // todo: change once modifying extension-switches is possible return(success); // this error may occur by trying to modify a parameter that is not available due to extension-settings bool IsParModError(string err) { return(err.Contains("not found (modification is ignored)")); } }
private bool EM2_Run(SystemBackgroundWorker sbw) { sbw.process = new Process(); sbw.process.StartInfo.FileName = EnvironmentInfo.GetEM2ExecutableFile(); sbw.process.StartInfo.Arguments += EnvironmentInfo.EncloseByQuotes(sbw.config.First().Key); sbw.process.StartInfo.CreateNoWindow = true; sbw.process.StartInfo.UseShellExecute = false; sbw.process.StartInfo.RedirectStandardError = true; sbw.process.ErrorDataReceived += (t1, t2) => { if (t2.Data != null && t2.Data != "") { sbw.em2_hasErrorFile = true; } }; sbw.process.Start(); sbw.process.BeginErrorReadLine(); sbw.process.WaitForExit(); return(sbw.process.ExitCode == 1); }
private void EM3_AddToRunInfoList(SystemBackgroundWorker sbw) { sbw.em3_RunInfo.systemName = sbw.systemName; sbw.em3_RunInfo.databaseName = sbw.databaseName; em3_runInfoList.Add(sbw.em3_RunInfo); }
private void EM2_RunBaselineSystems() { // get the systems of the checked addon (if one was checked) string addon = GetCheckedAddon(); bool hasAddon = addon != string.Empty; List <AddOnSystemInfo> addonSystems = hasAddon ? AddOnInfoHelper.GetAddOnSystemInfo(addon) : null; foreach (DataRow row in policyDataTable.Rows) { if (row.Field <bool>("Check")) { string countryShortName = row["Country"].ToString(); Country copiedCountry = CountryAdministrator.GetCopyOfCountry(countryShortName); CountryConfigFacade ccf = copiedCountry.GetCountryConfigFacade(); DataConfigFacade _dataConfigFacade = copiedCountry.GetDataConfigFacade(); DataConfig.DataBaseRow dbr1 = null; DataConfig.DataBaseRow dbr2 = null; foreach (DataConfig.DataBaseRow dataSet in _dataConfigFacade.GetDataBaseRows()) { if (dataSet.Name == row["Data1"].ToString()) { dbr1 = dataSet; } if (dataSet.Name == row["Data2"].ToString()) { dbr2 = dataSet; } } string sn1 = showFull ? row["System1"].ToString() : countryShortName + "_" + comboBox1.Text; string sn2 = showFull ? row["System2"].ToString() : countryShortName + "_" + comboBox2.Text; CountryConfig.SystemRow sr1 = ccf.GetSystemRowByName(sn1); CountryConfig.SystemRow sr2 = ccf.GetSystemRowByName(sn2); if (sr1 == null) { throw new Exception("System '" + sn1 + "' does not exist!"); } if (sr2 == null) { throw new Exception("System '" + sn2 + "' does not exist!"); } if (hasAddon) { if (checkRadioData1.Checked || checkRadioDataBoth.Checked) { MergeAddOn(addonSystems, copiedCountry, ref sr1); } if (checkRadioData2.Checked || checkRadioDataBoth.Checked) { MergeAddOn(addonSystems, copiedCountry, ref sr2); } } copiedCountry.WriteXML(EMPath.Folder_Temp(EM_AppContext.FolderEuromodFiles)); if (checkBoxAlphaMII.Checked) { SystemBackgroundWorker w1, w2; w1 = RunSystem(countryShortName, sr1.Name, dbr1.Name, EM2_CreateConfig(countryShortName, textBoxOutputPath.Text, dbr1, sr1, true)); w2 = RunSystem(countryShortName, sr2.Name, dbr2.Name, EM2_CreateConfig(countryShortName, textBoxOutputPath.Text, dbr2, sr2, true)); w1.isBaseline = true; w2.isBaseline = true; w1.secondBaseline = w2; w2.secondBaseline = w1; workers.Add(w1); workers.Add(w2); updateInfoLabel(); } else { SystemBackgroundWorker w1 = null, w2 = null; if (checkRadioData1.Checked || checkRadioDataBoth.Checked) { w1 = RunSystem(countryShortName, sr1.Name, dbr1.Name, EM2_CreateConfig(countryShortName, textBoxOutputPath.Text, dbr1, sr1, hasAddon)); w1.isBaseline = true; } if (checkRadioData2.Checked || checkRadioDataBoth.Checked) { w2 = RunSystem(countryShortName, sr2.Name, dbr2.Name, EM2_CreateConfig(countryShortName, textBoxOutputPath.Text, dbr2, sr2, hasAddon)); w2.isBaseline = true; } if (hasAddon && checkRadioDataBoth.Checked) { w1.secondBaseline = w2; w2.secondBaseline = w1; } if (checkRadioData1.Checked || checkRadioDataBoth.Checked) { workers.Add(w1); } if (checkRadioData2.Checked || checkRadioDataBoth.Checked) { workers.Add(w2); } updateInfoLabel(); } } } }