Example #1
0
        /// <todoc />
        public StringId ReadStringId(InlinedStringKind kind)
        {
            // Read the index
            var index = ReadInt32Compact();

            // Check if string already encountered
            if (index > m_maxReadStringIndex)
            {
                var binaryString = ReadStringIdValue(kind, ref m_buffer);
                var stringId     = m_pathTable.StringTable.AddString(binaryString);
                m_readStrings[(uint)index] = stringId;
                m_maxReadStringIndex       = index;
            }

            return(m_readStrings[(uint)index]);
        }
Example #2
0
        /// <todoc />
        public virtual BinaryStringSegment ReadStringIdValue(InlinedStringKind kind, ref byte[] buffer)
        {
            // This is a new string
            // Read if string is ascii or UTF-16
            bool isAscii = ReadBoolean();

            // Read the byte length
            int byteLength = ReadInt32Compact();

            CollectionUtilities.GrowArrayIfNecessary(ref buffer, byteLength);

            // Read the bytes into the buffer
            Read(buffer, 0, byteLength);

            var binaryString = new BinaryStringSegment(buffer, 0, byteLength, isAscii);

            return(binaryString);
        }
Example #3
0
            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));
                }
            }