1
1
using System ;
2
+ using System . Collections . Generic ;
2
3
using System . Diagnostics . Contracts ;
3
4
using System . Globalization ;
4
5
using ReClassNET . UI ;
@@ -9,6 +10,7 @@ public abstract class BaseHexNode : BaseNode
9
10
{
10
11
private readonly byte [ ] buffer ;
11
12
private DateTime highlightUntil ;
13
+ private readonly Dictionary < IntPtr , Tuple < byte [ ] , DateTime > > highlightHistory ;
12
14
13
15
public static DateTime CurrentHighlightTime ;
14
16
public static readonly TimeSpan HightlightDuration = TimeSpan . FromSeconds ( 1 ) ;
@@ -18,6 +20,7 @@ protected BaseHexNode()
18
20
Contract . Ensures ( buffer != null ) ;
19
21
20
22
buffer = new byte [ MemorySize ] ;
23
+ highlightHistory = new Dictionary < IntPtr , Tuple < byte [ ] , DateTime > > ( ) ;
21
24
}
22
25
23
26
protected int Draw ( ViewInfo view , int x , int y , string text , int length )
@@ -42,24 +45,15 @@ protected int Draw(ViewInfo view, int x, int y, string text, int length)
42
45
x = AddText ( view , x , y , view . Settings . TextColor , HotSpot . NoneId , text ) ;
43
46
}
44
47
45
- var color = view . Settings . HighlightChangedValues && highlightUntil > CurrentHighlightTime ? view . Settings . HighlightColor : view . Settings . HexColor ;
46
- var changed = false ;
47
- for ( var i = 0 ; i < length ; ++ i )
48
- {
49
- var b = view . Memory . ReadByte ( Offset + i ) ;
50
- if ( buffer [ i ] != b )
51
- {
52
- changed = true ;
48
+ view . Memory . ReadBytes ( Offset , buffer ) ;
53
49
54
- buffer [ i ] = b ;
55
- }
50
+ var color = view . Settings . HighlightChangedValues && view . Memory . HasChanged ( Offset , MemorySize )
51
+ ? view . Settings . HighlightColor
52
+ : view . Settings . HexColor ;
56
53
57
- x = AddText ( view , x , y , color , i , $ "{ b : X02} ") + view . Font . Width ;
58
- }
59
-
60
- if ( changed )
54
+ for ( var i = 0 ; i < length ; ++ i )
61
55
{
62
- highlightUntil = CurrentHighlightTime . Add ( HightlightDuration ) ;
56
+ x = AddText ( view , x , y , color , i , $ " { buffer [ i ] : X02 } " ) + view . Font . Width ;
63
57
}
64
58
65
59
AddComment ( view , x , y ) ;
0 commit comments