66using System . Linq ;
77using System . Text ;
88using System . Windows . Forms ;
9-
10- using BizHawk . Common ;
11- using BizHawk . Common . NumberExtensions ;
12- using BizHawk . Common . StringExtensions ;
13- using BizHawk . Emulation . Common ;
149using BizHawk . Client . Common ;
1510using BizHawk . Client . EmuHawk . Properties ;
1611using BizHawk . Client . EmuHawk . ToolExtensions ;
12+ using BizHawk . Common ;
1713using BizHawk . Common . CollectionExtensions ;
14+ using BizHawk . Common . NumberExtensions ;
15+ using BizHawk . Common . StringExtensions ;
16+ using BizHawk . Emulation . Common ;
1817using BizHawk . WinForms . Controls ;
1918
2019namespace BizHawk . Client . EmuHawk
2120{
2221 // int to long TODO: 32 bit domains have more digits than the hex editor can account for and the address covers up the 0 column
23- public partial class HexEditor : ToolFormBase , IToolFormAutoConfig
22+ public partial class HexEditor : ToolFormBase , IToolFormAutoConfig , IConfigPersist
2423 {
2524 private sealed class N64MatrixDisplayDialog : Form
2625 {
@@ -121,17 +120,13 @@ private bool AreAnyHighlighted
121120 private HexFind _hexFind ;
122121 private string _lastRom = "" ;
123122
124- [ ConfigPersist ]
125- private string LastDomain { get ; set ; }
123+ private string LastDomain ;
126124
127- [ ConfigPersist ]
128- private bool BigEndian { get ; set ; }
125+ private bool BigEndian ;
129126
130- [ ConfigPersist ]
131- private int DataSize { get ; set ; }
127+ private int DataSize ;
132128
133- [ ConfigPersist ]
134- private RecentFiles RecentTables { get ; set ; }
129+ private RecentFiles RecentTables ;
135130
136131 internal class ColorConfig
137132 {
@@ -143,8 +138,27 @@ internal class ColorConfig
143138 public Color HighlightFreeze { get ; set ; } = Color . Violet ;
144139 }
145140
146- [ ConfigPersist ]
147- internal ColorConfig Colors { get ; set ; } = new ColorConfig ( ) ;
141+ internal ColorConfig Colors = new ColorConfig ( ) ;
142+
143+ void IConfigPersist . LoadConfig ( IConfigPersist . Provider provider )
144+ {
145+ provider . Get ( nameof ( LastDomain ) , ref LastDomain ) ;
146+ provider . Get ( nameof ( BigEndian ) , ref BigEndian ) ;
147+ provider . Get ( nameof ( DataSize ) , ref DataSize ) ;
148+ provider . Get ( nameof ( RecentTables ) , ref RecentTables ) ;
149+ provider . Get ( nameof ( Colors ) , ref Colors ) ;
150+ }
151+ Dictionary < string , object > IConfigPersist . SaveConfig ( )
152+ {
153+ return new ( )
154+ {
155+ [ nameof ( LastDomain ) ] = LastDomain ,
156+ [ nameof ( BigEndian ) ] = BigEndian ,
157+ [ nameof ( DataSize ) ] = DataSize ,
158+ [ nameof ( RecentTables ) ] = RecentTables ,
159+ [ nameof ( Colors ) ] = Colors ,
160+ } ;
161+ }
148162
149163 private WatchSize WatchSize => ( WatchSize ) DataSize ;
150164
0 commit comments