Advertisement
kolton

Untitled

Dec 11th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. public void StopClient()
  2. {
  3. int i = 0;
  4. while (this.Status == Status.Starting)
  5. {
  6. if (i == 25)
  7. {
  8. break;
  9. }
  10.  
  11. System.Threading.Thread.Sleep(100);
  12. i += 1;
  13. }
  14.  
  15. if (this.Handle != default(Thread) && this.Handle.IsAlive)
  16. {
  17. this.Handle.Abort();
  18. }
  19.  
  20. if (this.D2Process != null)
  21. {
  22. Program.SendCopyData(this.D2Process.MainWindowHandle, "quitGame()", (IntPtr)0x1337);
  23.  
  24. for (i = 0; i < 10; i++)
  25. {
  26. if (this.D2Process == null || this.D2Process.HasExited)
  27. {
  28. break;
  29. }
  30.  
  31. System.Threading.Thread.Sleep(100);
  32. }
  33.  
  34. if (this.D2Process != null && !this.D2Process.HasExited)
  35. {
  36. try
  37. {
  38. this.D2Process.Kill();
  39. }
  40. catch
  41. {
  42. }
  43. }
  44.  
  45. this.D2Process = null;
  46. this.HeartAttack = 0;
  47. this.Crashed = 0;
  48. }
  49.  
  50. ProfileBase p;
  51. Program.Runtime.TryRemove(this.Name, out p);
  52.  
  53. this.StatusLock.EnterWriteLock();
  54. this.Status = Status.Stop;
  55. this.StatusLock.ExitWriteLock();
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement