/// <summary> /// This method is the delegate called when an export is to be handled using a plugin. /// </summary> /// <returns>True if the operation succeeded, False otherwise.</returns> private void ExportResults(WatcherOutputPlugin plugin, WatcherResultCollection results, String filename) { // Perform the Save operation. Not every save operation will return a // stream; therefore, a null return value is not necessarily an error. // // TODO: This class is a candidate for redesign as it handles exports with different semantics (e.g., TFS) Stream outputStream = plugin.SaveResult(results); if (outputStream != null) { using (FileStream fs = new FileStream(filename, FileMode.Create)) { Utility.ReadWriteStream(outputStream, fs); } } }