Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void StopClient()
- {
- int i = 0;
- while (this.Status == Status.Starting)
- {
- if (i == 25)
- {
- break;
- }
- System.Threading.Thread.Sleep(100);
- i += 1;
- }
- if (this.Handle != default(Thread) && this.Handle.IsAlive)
- {
- this.Handle.Abort();
- }
- if (this.D2Process != null)
- {
- Program.SendCopyData(this.D2Process.MainWindowHandle, "quitGame()", (IntPtr)0x1337);
- for (i = 0; i < 10; i++)
- {
- if (this.D2Process == null || this.D2Process.HasExited)
- {
- break;
- }
- System.Threading.Thread.Sleep(100);
- }
- if (this.D2Process != null && !this.D2Process.HasExited)
- {
- try
- {
- this.D2Process.Kill();
- }
- catch
- {
- }
- }
- this.D2Process = null;
- this.HeartAttack = 0;
- this.Crashed = 0;
- }
- ProfileBase p;
- Program.Runtime.TryRemove(this.Name, out p);
- this.StatusLock.EnterWriteLock();
- this.Status = Status.Stop;
- this.StatusLock.ExitWriteLock();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement