/// <summary> /// Writes a single data element to the formatter. /// </summary> /// <param name="formatter">Formatter</param> /// <param name="data">Tree Data</param> public static void Format(this IPhylogeneticTreeFormatter formatter, Tree data) { var fs = ParserFormatterExtensions <IPhylogeneticTreeFormatter> .GetOpenStream(formatter, true); if (fs != null) { formatter.Format(fs, data); } else { throw new Exception("You must open a formatter before calling Write."); } }
/// <summary> /// Writes a single sequence to the formatter. /// </summary> /// <param name="formatter">Formatter</param> /// <param name="data">Tree data</param> /// <param name="filename">Filename</param> public static void Format(this IPhylogeneticTreeFormatter formatter, Tree data, string filename) { if (formatter == null) { throw new ArgumentNullException("formatter"); } if (data == null) { throw new ArgumentNullException("data"); } if (string.IsNullOrWhiteSpace(filename)) { throw new ArgumentNullException("filename"); } using (var fs = File.Create(filename)) formatter.Format(fs, data); }