public void export(Trial trial) { ExportRun exportRun = ExportRun.Create(trial.Runs[0], exportSettings); List <string> dataRows = new List <string>(); string headerRow = String.Join <String>("\t", exportRun.Headers()); foreach (Run run in trial.Runs) { exportRun = ExportRun.Create(run, exportSettings); if (run.Status == Run.RunStatus.Complete) { Run.ValidationResult runValidationResult = run.Validate(); if (runValidationResult.IsValid) { dataRows.Add(String.Join <String>("\t", exportRun.RunData())); } } } string exportFilename = exportPath(trial); string exportDirectory = Path.GetDirectoryName(exportFilename); if (!Directory.Exists(exportDirectory)) { Directory.CreateDirectory(exportDirectory); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(exportFilename)) { file.WriteLine(headerRow); foreach (string dataRow in dataRows) { file.WriteLine(dataRow); } } }
public void export(Run run) { ExportRun exportRun = ExportRun.Create(run, exportSettings); string headerRow = String.Join <String>("\t", exportRun.Headers()); string dataRow = String.Join <String>("\t", exportRun.RunData()); string exportFilename = exportFile(run); string exportDirectory = Path.GetDirectoryName(exportFilename); if (!Directory.Exists(exportDirectory)) { Directory.CreateDirectory(exportDirectory); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(exportFilename)) { file.WriteLine(headerRow); file.WriteLine(dataRow); } }