예제 #1
0
        public string ReadStringsHeap(uint offset, uint maxLen = 0x200)
        {
            if (offset == 0)
            {
                return(string.Empty);
            }
            var  offs          = stringsHeapSpan.Start + offset;
            var  bytes         = new List <byte>();
            bool tooLongString = false;

            while (offs < stringsHeapSpan.End)
            {
                int b = buffer.TryReadByte(offs);
                if (b <= 0)
                {
                    break;
                }
                if (bytes.Count >= maxLen)
                {
                    tooLongString = true;
                    break;
                }
                bytes.Add((byte)b);
                offs++;
            }
            var s = Encoding.UTF8.GetString(bytes.ToArray());

            return(tooLongString ? s + "..." : s);
        }