private void RaiseCustomHeaderEvent(CustomHeaderEventArgs e) { if (CustomHeader != null) { CustomHeader(this, e); } }
protected override void CustomFormat(IEnumerable<object[]> objects, OperationInterop interop) { using (var sr = new StreamWriter(Streams.Values.Single(), Encoding ?? Encoding.Default)) { var ch = new CustomHeaderEventArgs(interop); RaiseCustomHeaderEvent(ch); if (!String.IsNullOrEmpty(ch.HeaderText)) { if (listDivider == null) { sr.WriteLine(ch.HeaderText); } else { sr.Write(ch.HeaderText + listDivider); } } foreach (var obj in objects) { if (listDivider == null) { sr.WriteLine(String.Join(elemDivider, obj)); } else { sr.Write(String.Join(elemDivider, obj) + listDivider); } interop.ThrowIfCancellationRequested(); } var cf = new CustomFooterEventArgs(interop, objects); RaiseCustomFooterEvent(cf); if (!String.IsNullOrEmpty(cf.FooterText)) { if (listDivider == null) { sr.WriteLine(cf.FooterText); } else { sr.Write(cf.FooterText + listDivider); } } sr.Flush(); } }