Example #1
0
        public byte[] GetString(out int offset, out int length)
        {
            StringHandleType type = _type;

            if (type == StringHandleType.UTF8)
            {
                offset = _offset;
                length = _length;
                return(_bufferReader.Buffer);
            }
            if (type == StringHandleType.Dictionary)
            {
                byte[] buffer = _bufferReader.GetDictionaryString(_key).ToUTF8();
                offset = 0;
                length = buffer.Length;
                return(buffer);
            }
            if (type == StringHandleType.ConstString)
            {
                byte[] buffer = XmlConverter.ToBytes(s_constStrings[_key]);
                offset = 0;
                length = buffer.Length;
                return(buffer);
            }
            else
            {
                DiagnosticUtility.DebugAssert(type == StringHandleType.EscapedUTF8, "");
                byte[] buffer = XmlConverter.ToBytes(_bufferReader.GetEscapedString(_offset, _length));
                offset = 0;
                length = buffer.Length;
                return(buffer);
            }
        }
Example #2
0
 private string GetEscapedCharsText()
 {
     DiagnosticUtility.DebugAssert(_type == ValueHandleType.EscapedUTF8, "");
     return(_bufferReader.GetEscapedString(_offset, _length));
 }