Skip to content

Commit 28515e2

Browse files
committed
Made just the string selectable.
1 parent c19403b commit 28515e2

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

ReClass.NET/Nodes/BaseHexCommentNode.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,26 @@ protected int AddComment(ViewInfo view, int x, int y, float fvalue, IntPtr ivalu
6666
{
6767
var data = view.Process.ReadRemoteMemory(ivalue, 64);
6868

69+
var isWideString = false;
70+
string text = null;
71+
6972
// First check if it could be an UTF8 string and if not try UTF16.
7073
if (data.Take(IntPtr.Size).InterpretAsSingleByteCharacter().IsPrintableData())
7174
{
72-
var text = new string(Encoding.UTF8.GetChars(data).TakeWhile(c => c != 0).ToArray());
73-
x = AddText(view, x, y, view.Settings.TextColor, HotSpot.ReadOnlyId, $"'{text}'") + view.Font.Width;
75+
text = new string(Encoding.UTF8.GetChars(data).TakeWhile(c => c != 0).ToArray());
7476
}
7577
else if(data.Take(IntPtr.Size * 2).InterpretAsDoubleByteCharacter().IsPrintableData())
7678
{
77-
var text = new string(Encoding.Unicode.GetChars(data).TakeWhile(c => c != 0).ToArray());
78-
x = AddText(view, x, y, view.Settings.TextColor, HotSpot.ReadOnlyId, $"L'{text}'") + view.Font.Width;
79+
isWideString = true;
80+
81+
text = new string(Encoding.Unicode.GetChars(data).TakeWhile(c => c != 0).ToArray());
82+
}
83+
84+
if (text != null)
85+
{
86+
x = AddText(view, x, y, view.Settings.TextColor, HotSpot.NoneId, isWideString ? "L'" : "'");
87+
x = AddText(view, x, y, view.Settings.TextColor, HotSpot.ReadOnlyId, text);
88+
x = AddText(view, x, y, view.Settings.TextColor, HotSpot.NoneId, "'") + view.Font.Width;
7989
}
8090
}
8191

0 commit comments

Comments
 (0)