public void Print(IEnumerable <Comment> head, Stream filesStream, PrintFormats selected) { var sw = new StreamWriter(filesStream); foreach (var comment in head) { sw.Write(PrettyPrint(comment)); } sw.Flush(); sw.Dispose(); }
public void Print(Comment head, string filePath, PrintFormats selected) { string body; switch (selected) { case PrintFormats.Html: body = PrettyPrint(head); break; case PrintFormats.Json: body = JsonPrint(head); break; default: throw new Exception("Should never hit"); } var sw = new StreamWriter(filePath); sw.Write(body); sw.Flush(); sw.Dispose(); }