/// <summary> /// Create new Process and initialize with parsed command line parameters /// </summary> /// <param name="gp">The GlobalParameters object containing global state</param> /// <param name="runner">The Runner object to execute the process</param> /// <param name="opts">The command line options</param> private static void RefreshProcess(GlobalParameters gp, Runner runner, CommandLineOptions opts) { string inpath = ""; string outpath = ""; //read snapshot configuration from database try { SqlConnection configConn = new SqlConnection(LoaderParamSingleton.createConnString(opts.database, opts.server)); configConn.Open(); SqlDataReader myReader = null; string command = "select * from dbo.config where sim = @sim and snapnum = @snapnum"; SqlCommand myCommand = new SqlCommand(command, configConn); SqlParameter timestepParam = new SqlParameter("@snapnum", System.Data.SqlDbType.SmallInt); SqlParameter simParam = new SqlParameter("@sim", System.Data.DbType.String); timestepParam.Value = opts.timestep; simParam.Value = opts.sim; myCommand.Parameters.Add(timestepParam); myCommand.Parameters.Add(simParam); myReader = myCommand.ExecuteReader(); //Can add any other properties we want to read from DB here int numLines = 0; while (myReader.Read()) { //TODO: do i need to escape backslashes in the paths? //I don't think so, it's been working fine so far inpath = myReader["inpath"].ToString(); outpath = myReader["outpath"].ToString(); numLines++; } configConn.Close(); if (numLines > 1) { throw new ConfigurationException( "Multiple entries matching this snapshot in configuration table"); } else if (numLines < 1) { throw new ConfigurationException( "Zero entries matching this snapshot in configuration table"); } gp.summary.setFile(outpath + "\\summary"); } /*catch (Exception e) { Console.Out.WriteLine("Caugth DB exception"); gp.summary.addError(e.Message); return; }*/ catch (Exception) { throw; } if (opts.snap) { Console.WriteLine("Adding Snapshot process to runner"); runner.Add(RefreshSnapshotsProcess(gp, inpath, outpath, opts)); } if (opts.fof) { runner.Add(RefreshIndraFOFProcess(gp, inpath, outpath, opts)); } if (opts.fft) { runner.Add(RefreshIndraFFTProcess(gp, inpath, outpath, opts)); } }
/// <summary> /// Create new Process and fill with parameters form GUI. /// </summary> private void RefreshProcess() { runner = new Runner(txtSQLCommandsFile.Text); RefreshGlobalParameters(); if(chkTransformSnapshots.Checked) runner.Add(RefreshSnapshotsProcess()); if (chkTransformSimDBFoF.Checked) runner.Add(RefreshSimDBFOFsProcess()); if (chkFFTData.Checked) runner.Add(RefreshFFTDataProcess()); }
/// <summary> /// Create new Process and fill with parameters form GUI. /// </summary> private void RefreshProcess() { runner = new Runner(txtSQLCommandsFile.Text); RefreshGlobalParameters(); if(chkTransformSnapshots.Checked) runner.Add(RefreshSnapshotsProcess()); if(chkTransformFOFOrderedSnapshots.Checked) runner.Add(RefreshFOFOrderedSnapshotsProcess()); if(chkTransformGroups.Checked) runner.Add(RefreshGroupsProcess()); if(chkTransformHaloTrees.Checked) runner.Add(RefreshHaloTreesProcess()); if (chkTransformGalaxies.Checked) runner.Add(RefreshGalaxyTreesProcess()); if (chkTransformSimDBFoF.Checked) runner.Add(RefreshSimDBFOFsProcess()); }