wasSharpNET – Diff between revs 11 and 27

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 11 Rev 27
Line 19... Line 19...
19 public static string GetProcessInstanceName(this System.Diagnostics.Process proc) 19 public static string GetProcessInstanceName(this System.Diagnostics.Process proc)
20 { 20 {
21 var cat = new PerformanceCounterCategory("Process"); 21 var cat = new PerformanceCounterCategory("Process");
Line 22... Line 22...
22   22  
23 foreach (var instance in cat.GetInstanceNames()) -  
24 { 23 foreach (var instance in cat.GetInstanceNames())
25 using (var cnt = new PerformanceCounter("Process", "ID Process", instance, true)) 24 using (var cnt = new PerformanceCounter("Process", "ID Process", instance, true))
26 { 25 {
27 var val = (int)cnt.RawValue; 26 var val = (int) cnt.RawValue;
28 if (val == proc.Id) -  
29 { 27 if (val == proc.Id)
30 return instance; -  
31 } 28 return instance;
32 } -  
33 } 29 }
34 return null; 30 return null;
35 } 31 }
36 } 32 }
37 } 33 }