public WriteContext WriteHeader(IFormattedWriter w, TeaFileDescription description) { var wc = new WriteContext(w); wc.ItemAreaStart = 32; // if no sections are created, ItemArea will start at 32. This value will change is sections are created wc.Description = description; byte[] sections = this.CreateSections(wc); w.WriteInt64(0x0d0e0a0402080500); w.WriteInt64(wc.ItemAreaStart); w.WriteInt64(0); w.WriteInt64(wc.SectionCount); wc.Writer.WriteRaw(sections); //var sectionPadding = wc.ItemAreaStart - w.Position; //if (sectionPadding < 0) throw new FileFormatException("Stream position (potentially after writing sections) is behind item start. After opening a TeaFile and reading the header, the file pointer must be exactly at the begin of the item area."); //w.WriteZeroBytes((int) sectionPadding); return wc; }
public WriteContext WriteHeader(IFormattedWriter w, TeaFileDescription description) { var wc = new WriteContext(w); wc.ItemAreaStart = 32; // if no sections are created, ItemArea will start at 32. This value will change is sections are created wc.Description = description; byte[] sections = this.CreateSections(wc); w.WriteInt64(0x0d0e0a0402080500); w.WriteInt64(wc.ItemAreaStart); w.WriteInt64(0); w.WriteInt64(wc.SectionCount); wc.Writer.WriteRaw(sections); //var sectionPadding = wc.ItemAreaStart - w.Position; //if (sectionPadding < 0) throw new FileFormatException("Stream position (potentially after writing sections) is behind item start. After opening a TeaFile and reading the header, the file pointer must be exactly at the begin of the item area."); //w.WriteZeroBytes((int) sectionPadding); return(wc); }
public WriteContext(IFormattedWriter writer) { this.Writer = writer; }