/// <summary> /// Internal for testing. /// </summary> internal void WriteSingleSection(Stream stream, DxfSectionType sectionType) { var sections = Sections.Where(s => s.Type == sectionType); var writer = PrepareWriter(stream, asText: true); WriteSectionsAndClose(writer, sections); }
internal static string ToString(DxfFile file, DxfSectionType sectionType) { using (var stream = new MemoryStream()) { file.WriteSingleSection(stream, sectionType); stream.Flush(); stream.Seek(0, SeekOrigin.Begin); using (var reader = new StreamReader(stream)) { return(reader.ReadToEnd()); } } }
public static string ToSectionName(this DxfSectionType section) { string name = null; switch (section) { case DxfSectionType.None: throw new NotImplementedException("Section type NONE not supported."); case DxfSectionType.Header: name = DxfSection.HeaderSectionText; break; case DxfSectionType.Classes: name = DxfSection.ClassesSectionText; break; case DxfSectionType.Tables: name = DxfSection.TablesSectionText; break; case DxfSectionType.Blocks: name = DxfSection.BlocksSectionText; break; case DxfSectionType.Entities: name = DxfSection.EntitiesSectionText; break; case DxfSectionType.Objects: name = DxfSection.ObjectsSectionText; break; case DxfSectionType.Thumbnail: name = DxfSection.ThumbnailImageSectionText; break; } return(name); }