/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. using System;
  4. using Debugger.Interop.CorDebug;
  5. namespace Debugger
  6. {
  7. public class ProcessCollection: CollectionWithEvents<Process>
  8. {
  9. public ProcessCollection(NDebugger debugger): base(debugger) {}
  10. internal Process this[ICorDebugProcess corProcess] {
  11. get {
  12. foreach (Process process in this) {
  13. if (process.CorProcess == corProcess) {
  14. return process;
  15. }
  16. }
  17. return null;
  18. }
  19. }
  20. protected override void OnRemoved(Process item)
  21. {
  22. base.OnRemoved(item);
  23. if (this.Count == 0) {
  24. // Exit callback and then terminate the debugger
  25. this.Debugger.MTA2STA.AsyncCall( delegate { this.Debugger.TerminateDebugger(); } );
  26. }
  27. }
  28. }
  29. }