11using System ;
2+ using System . Collections . Generic ;
23using System . Diagnostics . Contracts ;
34using System . Globalization ;
45using ReClassNET . UI ;
@@ -9,6 +10,7 @@ public abstract class BaseHexNode : BaseNode
910 {
1011 private readonly byte [ ] buffer ;
1112 private DateTime highlightUntil ;
13+ private readonly Dictionary < IntPtr , Tuple < byte [ ] , DateTime > > highlightHistory ;
1214
1315 public static DateTime CurrentHighlightTime ;
1416 public static readonly TimeSpan HightlightDuration = TimeSpan . FromSeconds ( 1 ) ;
@@ -18,6 +20,7 @@ protected BaseHexNode()
1820 Contract . Ensures ( buffer != null ) ;
1921
2022 buffer = new byte [ MemorySize ] ;
23+ highlightHistory = new Dictionary < IntPtr , Tuple < byte [ ] , DateTime > > ( ) ;
2124 }
2225
2326 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)
4245 x = AddText ( view , x , y , view . Settings . TextColor , HotSpot . NoneId , text ) ;
4346 }
4447
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 ) ;
5349
54- buffer [ i ] = b ;
55- }
50+ var color = view . Settings . HighlightChangedValues && view . Memory . HasChanged ( Offset , MemorySize )
51+ ? view . Settings . HighlightColor
52+ : view . Settings . HexColor ;
5653
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 )
6155 {
62- highlightUntil = CurrentHighlightTime . Add ( HightlightDuration ) ;
56+ x = AddText ( view , x , y , color , i , $ " { buffer [ i ] : X02 } " ) + view . Font . Width ;
6357 }
6458
6559 AddComment ( view , x , y ) ;
0 commit comments