@@ -14,14 +14,12 @@ public IntPtr Execute(Operation operation, RemoteProcess process)
1414 Contract . Requires ( operation != null ) ;
1515 Contract . Requires ( process != null ) ;
1616
17- var offsetOperation = operation as OffsetOperation ;
18- if ( offsetOperation != null )
17+ if ( operation is OffsetOperation offsetOperation )
1918 {
2019 return offsetOperation . Value ;
2120 }
2221
23- var moduleOffsetOperation = operation as ModuleOffsetOperation ;
24- if ( moduleOffsetOperation != null )
22+ if ( operation is ModuleOffsetOperation moduleOffsetOperation )
2523 {
2624 var module = process . GetModuleByName ( moduleOffsetOperation . Name ) ;
2725 if ( module != null )
@@ -32,38 +30,33 @@ public IntPtr Execute(Operation operation, RemoteProcess process)
3230 return IntPtr . Zero ;
3331 }
3432
35- var additionOperation = operation as AdditionOperation ;
36- if ( additionOperation != null )
33+ if ( operation is AdditionOperation additionOperation )
3734 {
3835 var addition = additionOperation ;
3936 return Execute ( addition . Argument1 , process ) . Add ( Execute ( addition . Argument2 , process ) ) ;
4037 }
4138
42- var subtractionOperation = operation as SubtractionOperation ;
43- if ( subtractionOperation != null )
39+ if ( operation is SubtractionOperation subtractionOperation )
4440 {
4541 var addition = subtractionOperation ;
4642 return Execute ( addition . Argument1 , process ) . Sub ( Execute ( addition . Argument2 , process ) ) ;
4743 }
4844
49- var multiplicationOperation = operation as MultiplicationOperation ;
50- if ( multiplicationOperation != null )
45+ if ( operation is MultiplicationOperation multiplicationOperation )
5146 {
5247 var multiplication = multiplicationOperation ;
5348 return Execute ( multiplication . Argument1 , process ) . Mul ( Execute ( multiplication . Argument2 , process ) ) ;
5449 }
5550
56- var divisionOperation = operation as DivisionOperation ;
57- if ( divisionOperation != null )
51+ if ( operation is DivisionOperation divisionOperation )
5852 {
5953 var division = divisionOperation ;
6054 return Execute ( division . Dividend , process ) . Div ( Execute ( division . Divisor , process ) ) ;
6155 }
6256
63- var pointerOperation = operation as ReadPointerOperation ;
64- if ( pointerOperation != null )
57+ if ( operation is ReadPointerOperation pointerOperation )
6558 {
66- return process . ReadRemoteObject < IntPtr > ( Execute ( pointerOperation . Argument , process ) ) ;
59+ return process . ReadRemoteIntPtr ( Execute ( pointerOperation . Argument , process ) ) ;
6760 }
6861
6962 throw new ArgumentException ( $ "Unsupported operation '{ operation . GetType ( ) . FullName } '.") ;
0 commit comments