@@ -27,15 +27,21 @@ internal class ScanValueTypeComboBox : EnumComboBox<ScanValueType> { }
2727
2828 private const int MaxVisibleResults = 10000 ;
2929
30+ private readonly RemoteProcess process ;
31+
3032 private bool isFirstScan ;
3133
3234 private Scanner scanner ;
3335 private CancellationTokenSource cts ;
3436
3537 private string addressFilePath ;
3638
37- public ScannerForm ( )
39+ public ScannerForm ( RemoteProcess process )
3840 {
41+ Contract . Requires ( process != null ) ;
42+
43+ this . process = process ;
44+
3945 InitializeComponent ( ) ;
4046
4147 toolStripPanel . Renderer = new CustomToolStripProfessionalRenderer ( true , false ) ;
@@ -47,10 +53,10 @@ public ScannerForm()
4753
4854 Reset ( ) ;
4955
50- firstScanButton . Enabled = flowLayoutPanel . Enabled = Program . RemoteProcess . IsValid ;
56+ firstScanButton . Enabled = flowLayoutPanel . Enabled = process . IsValid ;
5157
52- Program . RemoteProcess . ProcessAttached += RemoteProcessOnProcessAttached ;
53- Program . RemoteProcess . ProcessClosing += RemoteProcessOnProcessClosing ;
58+ process . ProcessAttached += RemoteProcessOnProcessAttached ;
59+ process . ProcessClosing += RemoteProcessOnProcessClosing ;
5460 }
5561
5662 protected override void OnLoad ( EventArgs e )
@@ -85,8 +91,8 @@ private void RemoteProcessOnProcessAttached(RemoteProcess remoteProcess)
8591 {
8692 foreach ( var record in addressListMemoryRecordList . Records )
8793 {
88- record . ResolveAddress ( Program . RemoteProcess ) ;
89- record . RefreshValue ( Program . RemoteProcess ) ;
94+ record . ResolveAddress ( process ) ;
95+ record . RefreshValue ( process ) ;
9096 }
9197 }
9298 }
@@ -103,14 +109,14 @@ private void MemorySearchForm_FormClosing(object sender, FormClosingEventArgs e)
103109 {
104110 scanner ? . Dispose ( ) ;
105111
106- Program . RemoteProcess . ProcessAttached -= RemoteProcessOnProcessAttached ;
107- Program . RemoteProcess . ProcessClosing -= RemoteProcessOnProcessClosing ;
112+ process . ProcessAttached -= RemoteProcessOnProcessAttached ;
113+ process . ProcessClosing -= RemoteProcessOnProcessClosing ;
108114 }
109115
110116 private void updateValuesTimer_Tick ( object sender , EventArgs e )
111117 {
112- resultMemoryRecordList . RefreshValues ( Program . RemoteProcess ) ;
113- addressListMemoryRecordList . RefreshValues ( Program . RemoteProcess ) ;
118+ resultMemoryRecordList . RefreshValues ( process ) ;
119+ addressListMemoryRecordList . RefreshValues ( process ) ;
114120 }
115121
116122 private void scanTypeComboBox_SelectionChangeCommitted ( object sender , EventArgs e )
@@ -147,7 +153,7 @@ private async void firstScanButton_Click(object sender, EventArgs e)
147153
148154 private async void nextScanButton_Click ( object sender , EventArgs e )
149155 {
150- if ( ! Program . RemoteProcess . IsValid )
156+ if ( ! process . IsValid )
151157 {
152158 return ;
153159 }
@@ -245,8 +251,8 @@ private void openAddressFileToolStripButton_Click(object sender, EventArgs e)
245251 import . Load ( ofd . FileName , Program . Logger )
246252 . Select ( r =>
247253 {
248- r . ResolveAddress ( Program . RemoteProcess ) ;
249- r . RefreshValue ( Program . RemoteProcess ) ;
254+ r . ResolveAddress ( process ) ;
255+ r . RefreshValue ( process ) ;
250256 return r ;
251257 } )
252258 ) ;
@@ -301,7 +307,7 @@ private void clearAddressListToolStripButton_Click(object sender, EventArgs e)
301307
302308 private void showInputCorrelatorIconButton_Click ( object sender , EventArgs e )
303309 {
304- new InputCorrelatorForm ( this ) . Show ( ) ;
310+ new InputCorrelatorForm ( this , process ) . Show ( ) ;
305311 }
306312
307313 private void resultListContextMenuStrip_Opening ( object sender , CancelEventArgs e )
@@ -415,7 +421,7 @@ public void ShowScannerResults(Scanner scanner)
415421 . Select ( r =>
416422 {
417423 var record = new MemoryRecord ( r ) ;
418- record . ResolveAddress ( Program . RemoteProcess ) ;
424+ record . ResolveAddress ( process ) ;
419425 return record ;
420426 } )
421427 ) ;
@@ -586,7 +592,7 @@ public void ExcuteScan(ScanSettings settings, IScanComparer comparer)
586592 /// <param name="comparer">The comparer.</param>
587593 private async Task StartFirstScanEx ( ScanSettings settings , IScanComparer comparer )
588594 {
589- if ( ! Program . RemoteProcess . IsValid )
595+ if ( ! process . IsValid )
590596 {
591597 return ;
592598 }
@@ -596,7 +602,7 @@ private async Task StartFirstScanEx(ScanSettings settings, IScanComparer compare
596602
597603 try
598604 {
599- scanner = new Scanner ( Program . RemoteProcess , settings ) ;
605+ scanner = new Scanner ( process , settings ) ;
600606
601607 var report = new Progress < int > ( i =>
602608 {
0 commit comments