PageRenderTime 11ms CodeModel.GetById 7ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Debugger/Debugger.Core/ProcessCollection.cs

http://github.com/icsharpcode/ILSpy
C# | 34 lines | 26 code | 5 blank | 3 comment | 4 complexity | f03707567feb12f86d250a890700f0f1 MD5 | raw file
 1// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 2// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 3
 4using System;
 5using Debugger.Interop.CorDebug;
 6
 7namespace Debugger
 8{
 9	public class ProcessCollection: CollectionWithEvents<Process>
10	{
11		public ProcessCollection(NDebugger debugger): base(debugger) {}
12		
13		internal Process this[ICorDebugProcess corProcess] {
14			get {
15				foreach (Process process in this) {
16					if (process.CorProcess == corProcess) {
17						return process;
18					}
19				}
20				return null;
21			}
22		}
23
24		protected override void OnRemoved(Process item)
25		{
26			base.OnRemoved(item);
27			
28			if (this.Count == 0) {
29				// Exit callback and then terminate the debugger
30				this.Debugger.MTA2STA.AsyncCall( delegate { this.Debugger.TerminateDebugger(); } );
31			}
32		}
33	}
34}