Ejemplo n.º 1
0
        /// <summary>
        /// Disconnects from allsrv, logs games that were in progress and shuts down TAG.
        /// </summary>
        public static void Stop()
        {
            TagTrace.WriteLine(TraceLevel.Info, "Shutting down...");
            // De-initialize core (unhook events)
            AGCEventHandler.Uninitialize();
            TagTrace.WriteLine(TraceLevel.Verbose, "Events unhooked.");

            TagTrace.WriteLine(TraceLevel.Info, "Shutting the logger down...");
            // Shutdown the logger
            GameLogger.Uninitialize();
            TagTrace.WriteLine(TraceLevel.Verbose, "Logger shut down.");

            TagTrace.WriteLine(TraceLevel.Info, "Disconnecting from Allsrv...");
            // Disconnect from allsrv
            GameServer.Disconnect();
            TagTrace.WriteLine(TraceLevel.Verbose, "Disconnected.");

            TagTrace.WriteLine(TraceLevel.Info, "Exiting...");
            // Signal the "Main" thread to end processing
            if (_closeAppResetEvent != null)
            {
                _closeAppResetEvent.Set();
            }

            // Allow the main thread to end, or force-close after 5s
            if (_mainThread != null)
            {
                _mainThread.Join(5000);
            }

            // Shutdown Tracing and Debugging
            TagTrace.Uninitialize();
            TagTrace.Uninitialize();
        }