public void WriteMatchedRecord(IStreamReader reader, Record record) { reader.VerifyThatObjectIsNotNull("Cannot write matched record. Parameter 'reader' is null."); record.VerifyThatObjectIsNotNull("Cannot write matched record. Parameter 'record' is null."); if (!this.DoWriteMatchedRecords) { throw new InvalidOperationException("Writer not set to write out matched record."); } if (this.matchedWriter == null) { this.matchedWriter = new StreamWriter(this.matchedFilePath); } this.statisticsCollector.RecordWrittenToOutputFile(this.matchedFilePath); StreamWriteOperations.WriteRecordToStream(this.matchedWriter, reader, record); }
private void WriteRecordsToFile(IStreamReader reader, Record record, String outputPrefix) { reader.VerifyThatObjectIsNotNull("Cannot write record. Parameter 'reader' is null."); record.VerifyThatObjectIsNotNull("Cannot write record. Parameter 'record' is null."); StreamWriter writer; String outputName = Path.GetDirectoryName(reader.Name) + @"\" + outputPrefix + Path.GetFileName(reader.Name); if (!writers.ContainsKey(outputName)) { writer = new StreamWriter(outputName); writers.Add(outputName, writer); } else { writer = writers[outputName]; } this.statisticsCollector.RecordWrittenToOutputFile(outputName); StreamWriteOperations.WriteRecordToStream(writer, reader, record); }