/// <summary> /// Creates a new instance of <see cref="TdilSectionWriter"/>. The content of this writer is being appended to the /// unit writer when it's being disposed. /// </summary> /// <param name="sectionName">Name of the section</param> /// <param name="sectionParameterNames">Name of section parameters</param> /// <returns>Instance of <see cref="TdilSectionWriter"/></returns> public TdilSectionWriter CreateSection(string sectionName, string[] sectionParameterNames) { EnsureHeaderWritten(); TdilSectionWriter sectionWriter = new TdilSectionWriter(sectionName, sectionParameterNames); sectionWriter.Disposing += OnSectionWriterDisposing; return(sectionWriter); }
/// <summary> /// Is invoked when an instance of <see cref="TdilSectionWriter"/> is disposed that has being created by calling /// <see cref="CreateSection(string)"/>. /// </summary> /// <param name="sender">Event dispatcher</param> /// <param name="eventArgs">Event arguments</param> private void OnSectionWriterDisposing(object sender, EventArgs eventArgs) { TdilSectionWriter sectionWriter = (TdilSectionWriter)sender; sectionWriter.Disposing -= OnSectionWriterDisposing; string sectionText = sectionWriter.WriteToString(); AppendLine(sectionText); }