Exemplo n.º 1
0
        public void Stop()
        {
            // Are we already stopped?
            if (this.State == ConsoleState.Stopped)
            {
                return;
            }

            if (this.workerThread != null && this.workerThread.ManagedThreadId == Thread.CurrentThread.ManagedThreadId)
            {
            }                      // The worker's trying to kill itself? I dunno what to do. Screw it.

            /////////////////
            // Stop the core.

            if (this.State == ConsoleState.Running)
            {
                this.InternalPause();
            }

            // Close the game source.
            try
            {
                this.GameSource.Close();
            }
            catch { }             // Might happen, but I don't care. The game source shouldn't have done that.

            // Done!
            FreeDOCore.Destroy();
            this.State = ConsoleState.Stopped;
        }