@@ -68,7 +68,7 @@ private List<Result> CreateResultsFromProcesses(List<ProcessResult> processlist,
68
68
results . Insert ( 0 , new Result ( )
69
69
{
70
70
IcoPath = "Images\\ app.png" ,
71
- Title = "kill all \" " + termToSearch + "\" process " ,
71
+ Title = "kill all \" " + termToSearch + "\" processes " ,
72
72
SubTitle = "" ,
73
73
Score = 200 ,
74
74
Action = ( c ) =>
@@ -96,29 +96,25 @@ void KillProcess(Process p)
96
96
}
97
97
catch ( Exception e )
98
98
{
99
- Log . Exception ( $ "Fail to kill process { p . ProcessName } ", e ) ;
99
+ Log . Exception ( $ "|ProcessKiller.CreateResultsFromProcesses|Failed to kill process { p . ProcessName } ", e ) ;
100
100
}
101
101
}
102
102
}
103
103
private List < ProcessResult > GetProcesslist ( string termToSearch )
104
104
{
105
105
var processlist = new List < ProcessResult > ( ) ;
106
- var processes = Process . GetProcesses ( ) ;
107
- if ( string . IsNullOrWhiteSpace ( termToSearch ) )
106
+
107
+ foreach ( var p in Process . GetProcesses ( ) )
108
108
{
109
- // show all process
110
- foreach ( var p in processes )
111
- {
112
- if ( FilterSystemProcesses ( p ) ) continue ;
109
+ if ( FilterSystemProcesses ( p ) ) continue ;
113
110
111
+ if ( string . IsNullOrWhiteSpace ( termToSearch ) )
112
+ {
113
+ // show all non-system processes
114
114
processlist . Add ( new ProcessResult ( p , 0 ) ) ;
115
115
}
116
- }
117
- else
118
- {
119
- foreach ( var p in processes )
116
+ else
120
117
{
121
- if ( FilterSystemProcesses ( p ) ) continue ;
122
118
var score = StringMatcher . FuzzySearch ( termToSearch , p . ProcessName + p . Id ) . Score ;
123
119
if ( score > 0 )
124
120
{
@@ -132,9 +128,7 @@ private List<ProcessResult> GetProcesslist(string termToSearch)
132
128
bool FilterSystemProcesses ( Process p )
133
129
{
134
130
var name = p . ProcessName . ToLower ( ) ;
135
- if ( _systemProcessList . Contains ( name ) )
136
- return true ;
137
- return false ;
131
+ return _systemProcessList . Contains ( name ) ;
138
132
}
139
133
}
140
134
0 commit comments