protected override BinaryStringSegment ReadBinaryStringSegment(ref byte[] buffer) { int count = ReadInt32Compact(); return(PipDataBuilder.WriteEntries(GetEntries(), count, ref m_pipDatabuffer)); IEnumerable <PipDataEntry> GetEntries() { for (int i = 0; i < count; i++) { yield return(PipDataEntry.Deserialize(m_baseInliningReader)); } } }
public override BinaryStringSegment ReadStringIdValue(InlinedStringKind kind, ref byte[] buffer) { if (kind == InlinedStringKind.PipData) { int count = ReadInt32Compact(); return(PipDataBuilder.WriteEntries(GetEntries(), count, ref m_pipDatabuffer)); IEnumerable <PipDataEntry> GetEntries() { for (int i = 0; i < count; i++) { yield return(PipDataEntry.Deserialize(this)); } } } else { return(base.ReadStringIdValue(kind, ref buffer)); } }
internal static PipData Deserialize(PipReader reader) { Contract.Requires(reader != null); var entriesBinarySegmentPointer = reader.ReadPipDataEntriesPointer(); PipDataEntry headerEntry; PipDataEntryList entries; if (entriesBinarySegmentPointer.IsValid) { headerEntry = PipDataEntry.Deserialize(reader); // Use the string table to get the raw bytes to back the entries entries = new PipDataEntryList(reader.StringTable.GetBytes(entriesBinarySegmentPointer)); } else { var count = reader.ReadInt32Compact(); if (count == 0) { return(Invalid); } headerEntry = PipDataEntry.Deserialize(reader); var entriesArray = new PipDataEntry[count]; for (int i = 0; i < count; i++) { entriesArray[i] = PipDataEntry.Deserialize(reader); } entries = PipDataEntryList.FromEntries(entriesArray); } Contract.Assume(headerEntry.EntryType == PipDataEntryType.NestedDataHeader); Contract.Assume(headerEntry.Escaping != PipDataFragmentEscaping.Invalid); return(new PipData(headerEntry, entries, entriesBinarySegmentPointer)); }