protected string ReadString(TargetMemoryAccess target, TargetLocation start) { if (start.HasAddress && start.GetAddress(target).IsNull) { return("null"); } StringBuilder sb = new StringBuilder(); bool done = false; int offset = 0; while (!done && (offset < MaximumDynamicSize)) { TargetLocation location = start.GetLocationAtOffset(offset); byte[] buffer = location.ReadBuffer(target, ChunkSize); int pos = 0; int size = buffer.Length; char[] char_buffer = new char [size * 3]; for (int i = 0; i < size; i++) { if (buffer [i] == 0) { done = true; break; } char ch = (char)buffer [i]; if (Char.IsLetterOrDigit(ch) || Char.IsPunctuation(ch) || Char.IsWhiteSpace(ch) || (ch == '<') || (ch == '>')) { char_buffer [pos++] = ch; } else if (ch == '\\') { char_buffer [pos++] = '\\'; char_buffer [pos++] = '\\'; } else if ((ch == '\'') || (ch == '`')) { char_buffer [pos++] = ch; } else { char_buffer [pos++] = '\\'; char_buffer [pos++] = hex_chars [(ch & 0xf0) >> 4]; char_buffer [pos++] = hex_chars [ch & 0x0f]; } } string str = new String(char_buffer, 0, pos); sb.Append(str); offset += size; } return(sb.ToString()); }