@@ -29,12 +29,9 @@ public ProcessInfo SelectedProcess
2929 {
3030 get
3131 {
32- var row = ( processDataGridView . SelectedRows . Cast < DataGridViewRow > ( ) . FirstOrDefault ( ) ? . DataBoundItem as DataRowView ) ? . Row ;
33- if ( row != null )
34- {
35- return new ProcessInfo ( row . Field < IntPtr > ( "id" ) , row . Field < string > ( "name" ) , row . Field < string > ( "path" ) ) ;
36- }
37- return null ;
32+ return ( processDataGridView . SelectedRows . Cast < DataGridViewRow > ( ) . FirstOrDefault ( ) ? . DataBoundItem as DataRowView )
33+ ? . Row
34+ ? . Field < ProcessInfo > ( "info" ) ;
3835 }
3936 }
4037
@@ -116,17 +113,18 @@ private void RefreshProcessList()
116113 dt . Columns . Add ( "name" , typeof ( string ) ) ;
117114 dt . Columns . Add ( "id" , typeof ( IntPtr ) ) ;
118115 dt . Columns . Add ( "path" , typeof ( string ) ) ;
116+ dt . Columns . Add ( "info" , typeof ( ProcessInfo ) ) ;
119117
120- coreFunctions . EnumerateProcesses ( data =>
118+ coreFunctions . EnumerateProcesses ( p =>
121119 {
122- var moduleName = Path . GetFileName ( data . Item2 ) ;
123- if ( ! filterCheckBox . Checked || ! CommonProcesses . Contains ( moduleName . ToLower ( ) ) )
120+ if ( ! filterCheckBox . Checked || ! CommonProcesses . Contains ( p . Name . ToLower ( ) ) )
124121 {
125122 var row = dt . NewRow ( ) ;
126- row [ "icon" ] = NativeMethods . GetIconForFile ( data . Item2 ) ;
127- row [ "name" ] = moduleName ;
128- row [ "id" ] = data . Item1 ;
129- row [ "path" ] = data . Item2 ;
123+ row [ "icon" ] = NativeMethods . GetIconForFile ( p . Path ) ;
124+ row [ "name" ] = p . Name ;
125+ row [ "id" ] = p . Id ;
126+ row [ "path" ] = p . Path ;
127+ row [ "info" ] = p ;
130128 dt . Rows . Add ( row ) ;
131129 }
132130 } ) ;
0 commit comments