@@ -27,15 +27,21 @@ internal class ScanValueTypeComboBox : EnumComboBox<ScanValueType> { }
27
27
28
28
private const int MaxVisibleResults = 10000 ;
29
29
30
+ private readonly RemoteProcess process ;
31
+
30
32
private bool isFirstScan ;
31
33
32
34
private Scanner scanner ;
33
35
private CancellationTokenSource cts ;
34
36
35
37
private string addressFilePath ;
36
38
37
- public ScannerForm ( )
39
+ public ScannerForm ( RemoteProcess process )
38
40
{
41
+ Contract . Requires ( process != null ) ;
42
+
43
+ this . process = process ;
44
+
39
45
InitializeComponent ( ) ;
40
46
41
47
toolStripPanel . Renderer = new CustomToolStripProfessionalRenderer ( true , false ) ;
@@ -47,10 +53,10 @@ public ScannerForm()
47
53
48
54
Reset ( ) ;
49
55
50
- firstScanButton . Enabled = flowLayoutPanel . Enabled = Program . RemoteProcess . IsValid ;
56
+ firstScanButton . Enabled = flowLayoutPanel . Enabled = process . IsValid ;
51
57
52
- Program . RemoteProcess . ProcessAttached += RemoteProcessOnProcessAttached ;
53
- Program . RemoteProcess . ProcessClosing += RemoteProcessOnProcessClosing ;
58
+ process . ProcessAttached += RemoteProcessOnProcessAttached ;
59
+ process . ProcessClosing += RemoteProcessOnProcessClosing ;
54
60
}
55
61
56
62
protected override void OnLoad ( EventArgs e )
@@ -85,8 +91,8 @@ private void RemoteProcessOnProcessAttached(RemoteProcess remoteProcess)
85
91
{
86
92
foreach ( var record in addressListMemoryRecordList . Records )
87
93
{
88
- record . ResolveAddress ( Program . RemoteProcess ) ;
89
- record . RefreshValue ( Program . RemoteProcess ) ;
94
+ record . ResolveAddress ( process ) ;
95
+ record . RefreshValue ( process ) ;
90
96
}
91
97
}
92
98
}
@@ -103,14 +109,14 @@ private void MemorySearchForm_FormClosing(object sender, FormClosingEventArgs e)
103
109
{
104
110
scanner ? . Dispose ( ) ;
105
111
106
- Program . RemoteProcess . ProcessAttached -= RemoteProcessOnProcessAttached ;
107
- Program . RemoteProcess . ProcessClosing -= RemoteProcessOnProcessClosing ;
112
+ process . ProcessAttached -= RemoteProcessOnProcessAttached ;
113
+ process . ProcessClosing -= RemoteProcessOnProcessClosing ;
108
114
}
109
115
110
116
private void updateValuesTimer_Tick ( object sender , EventArgs e )
111
117
{
112
- resultMemoryRecordList . RefreshValues ( Program . RemoteProcess ) ;
113
- addressListMemoryRecordList . RefreshValues ( Program . RemoteProcess ) ;
118
+ resultMemoryRecordList . RefreshValues ( process ) ;
119
+ addressListMemoryRecordList . RefreshValues ( process ) ;
114
120
}
115
121
116
122
private void scanTypeComboBox_SelectionChangeCommitted ( object sender , EventArgs e )
@@ -147,7 +153,7 @@ private async void firstScanButton_Click(object sender, EventArgs e)
147
153
148
154
private async void nextScanButton_Click ( object sender , EventArgs e )
149
155
{
150
- if ( ! Program . RemoteProcess . IsValid )
156
+ if ( ! process . IsValid )
151
157
{
152
158
return ;
153
159
}
@@ -245,8 +251,8 @@ private void openAddressFileToolStripButton_Click(object sender, EventArgs e)
245
251
import . Load ( ofd . FileName , Program . Logger )
246
252
. Select ( r =>
247
253
{
248
- r . ResolveAddress ( Program . RemoteProcess ) ;
249
- r . RefreshValue ( Program . RemoteProcess ) ;
254
+ r . ResolveAddress ( process ) ;
255
+ r . RefreshValue ( process ) ;
250
256
return r ;
251
257
} )
252
258
) ;
@@ -301,7 +307,7 @@ private void clearAddressListToolStripButton_Click(object sender, EventArgs e)
301
307
302
308
private void showInputCorrelatorIconButton_Click ( object sender , EventArgs e )
303
309
{
304
- new InputCorrelatorForm ( this ) . Show ( ) ;
310
+ new InputCorrelatorForm ( this , process ) . Show ( ) ;
305
311
}
306
312
307
313
private void resultListContextMenuStrip_Opening ( object sender , CancelEventArgs e )
@@ -415,7 +421,7 @@ public void ShowScannerResults(Scanner scanner)
415
421
. Select ( r =>
416
422
{
417
423
var record = new MemoryRecord ( r ) ;
418
- record . ResolveAddress ( Program . RemoteProcess ) ;
424
+ record . ResolveAddress ( process ) ;
419
425
return record ;
420
426
} )
421
427
) ;
@@ -586,7 +592,7 @@ public void ExcuteScan(ScanSettings settings, IScanComparer comparer)
586
592
/// <param name="comparer">The comparer.</param>
587
593
private async Task StartFirstScanEx ( ScanSettings settings , IScanComparer comparer )
588
594
{
589
- if ( ! Program . RemoteProcess . IsValid )
595
+ if ( ! process . IsValid )
590
596
{
591
597
return ;
592
598
}
@@ -596,7 +602,7 @@ private async Task StartFirstScanEx(ScanSettings settings, IScanComparer compare
596
602
597
603
try
598
604
{
599
- scanner = new Scanner ( Program . RemoteProcess , settings ) ;
605
+ scanner = new Scanner ( process , settings ) ;
600
606
601
607
var report = new Progress < int > ( i =>
602
608
{
0 commit comments