3
3
using System . Collections . Generic ;
4
4
using System . Diagnostics ;
5
5
using System . Linq ;
6
+ using System . Text ;
6
7
using Windows . Win32 ;
7
8
using Windows . Win32 . Foundation ;
8
9
using Windows . Win32 . System . Threading ;
@@ -31,15 +32,20 @@ internal class ProcessHelper
31
32
32
33
private const string FlowLauncherProcessName = "Flow.Launcher" ;
33
34
34
- private bool IsSystemProcess ( Process p ) => _systemProcessList . Contains ( p . ProcessName . ToLower ( ) ) ||
35
- string . Compare ( p . ProcessName , FlowLauncherProcessName , StringComparison . OrdinalIgnoreCase ) == 0 ;
35
+ private bool IsSystemProcessOrFlowLauncher ( Process p ) =>
36
+ _systemProcessList . Contains ( p . ProcessName . ToLower ( ) ) ||
37
+ string . Equals ( p . ProcessName , FlowLauncherProcessName , StringComparison . OrdinalIgnoreCase ) ;
36
38
37
39
/// <summary>
38
40
/// Get title based on process name and id
39
41
/// </summary>
40
42
public static string GetProcessNameIdTitle ( Process p )
41
43
{
42
- return p . ProcessName + " - " + p . Id ;
44
+ var sb = new StringBuilder ( ) ;
45
+ sb . Append ( p . ProcessName ) ;
46
+ sb . Append ( " - " ) ;
47
+ sb . Append ( p . Id ) ;
48
+ return sb . ToString ( ) ;
43
49
}
44
50
45
51
/// <summary>
@@ -51,7 +57,7 @@ public List<Process> GetMatchingProcesses()
51
57
52
58
foreach ( var p in Process . GetProcesses ( ) )
53
59
{
54
- if ( IsSystemProcess ( p ) ) continue ;
60
+ if ( IsSystemProcessOrFlowLauncher ( p ) ) continue ;
55
61
56
62
processlist . Add ( p ) ;
57
63
}
@@ -110,7 +116,7 @@ private static unsafe string GetWindowTitle(HWND hwnd)
110
116
/// </summary>
111
117
public IEnumerable < Process > GetSimilarProcesses ( string processPath )
112
118
{
113
- return Process . GetProcesses ( ) . Where ( p => ! IsSystemProcess ( p ) && TryGetProcessFilename ( p ) == processPath ) ;
119
+ return Process . GetProcesses ( ) . Where ( p => ! IsSystemProcessOrFlowLauncher ( p ) && TryGetProcessFilename ( p ) == processPath ) ;
114
120
}
115
121
116
122
public void TryKill ( PluginInitContext context , Process p )
0 commit comments