public AssemblyBytes(Stream s) { this.Stream = s; FileFormat = new FileFormat { Bytes = this }; FileFormat.NodeName = "FileFormat"; try { FileFormat.Read(); } catch (EndOfStreamException e) { FileFormat.Errors.Add(e.ToString()); } // Reading custom values from the blob heap is lazy, mutating the heap children. // Touch all entries now so sorting sees them before JSON serialization. FileFormat.CallBack(n => { DoNothing(n.Description); DoNothing(n.NodeValue); }); FileFormat.CallBack(n => { n.Children = n.Children.OrderBy(c => c.Start).ToList(); }); FileFormat.CallBack(n => { if (n.End > s.Length) { n.Errors.Add($"End was set beyond byte end to {n.End}"); } if (n.Start < 0) { n.Errors.Add($"Start was set to {n.Start}"); } }); FileFormat.AssignPath(); }