示例#1
0
        /// <summary>
        /// Creates a PipData instance.
        /// </summary>
        internal static PipData CreateInternal(PipDataEntry entry, PipDataEntryList entries, StringId entriesBinarySegmentPointer)
        {
            Contract.Requires(entry.EntryType == PipDataEntryType.NestedDataHeader);
            Contract.Requires(entry.GetStringValue().IsValid);

            return(new PipData(entry, entries, entriesBinarySegmentPointer));
        }
示例#2
0
        /// <summary>
        /// Internal constructor, please use CreateSourceFile.... overloads to instantiate this type.
        /// </summary>
        internal PipFragment(PipDataEntryList entries, int index)
        {
            // Ensure the entry can be accessed from the array
            Contract.Requires(entries.Count != 0);
            Contract.Requires(index >= 0 && index < entries.Count);

            m_entries = entries.GetSubView(index);
        }
示例#3
0
        private PipData(PipDataEntry entry, PipDataEntryList entries, StringId entriesBinarySegmentPointer)
        {
            Contract.Requires(entry.EntryType == PipDataEntryType.NestedDataHeader);
            Contract.Requires(entry.Escaping != PipDataFragmentEscaping.Invalid);
            Contract.Requires(entries.Count != 0);

            HeaderEntry = entry;
            Entries     = entries;
            m_entriesBinarySegmentPointer = entriesBinarySegmentPointer;
        }
示例#4
0
        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));
        }
示例#5
0
            protected override BinaryStringSegment ReadBinaryStringSegment(ref byte[] buffer)
            {
                var(count, entries) = PipDataEntryList.Deserialize(m_baseInliningReader);

                return(PipDataBuilder.WriteEntries(entries, count, ref m_pipDatabuffer));
            }
示例#6
0
 public bool Equals(PipDataEntryList other)
 {
     return(m_bytes.Equals(other.m_bytes));
 }
示例#7
0
 /// <summary>
 /// Private constructor for test pip fragments
 /// </summary>
 private PipFragment(PipDataEntry[] entries, int index)
     : this(PipDataEntryList.FromEntries(entries), index)
 {
 }