Esempio n. 1
0
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources
        /// </summary>
        public void Dispose()
        {
            if (disposed)
            {
                return;
            }
            disposed = true;

            if (WorkerQueryRunner != null)
            {
                WorkerQueryRunner.AddLogEntry(new LogEntryLight(LogLevel.Info, string.Format("TS3-Bot '{0}' disconnected.", BotInstance.Settings.Global.BotNickname)));
            }

            if (TcpDispatcher != null && TcpDispatcher.IsConnected && !TcpDispatcher.IsDisposed && QueryRunner != null)
            {
                QueryRunner.Logout();
                QueryRunner.Quit();
                TcpDispatcher.Disconnect();
            }
            if (WorkerTcpDispatcher != null && WorkerTcpDispatcher.IsConnected && !WorkerTcpDispatcher.IsDisposed && WorkerQueryRunner != null)
            {
                WorkerQueryRunner.Logout();
                WorkerQueryRunner.Quit();
                WorkerTcpDispatcher.Disconnect();
            }
            if (NotificationTcpDispatcher != null && NotificationTcpDispatcher.IsConnected && !NotificationTcpDispatcher.IsDisposed && NotificationQueryRunner != null)
            {
                NotificationQueryRunner.Logout();
                NotificationQueryRunner.Quit();
                NotificationTcpDispatcher.Disconnect();
            }

            GC.SuppressFinalize(this);
        }
Esempio n. 2
0
		/// <summary>
		///     A whole neww worlddddddd!
		/// </summary>
		public World() {
			mEntities = new ConcurrentDictionary<int, ServerEntity>();

			mTcp = new TcpDispatcher(IPAddress.Any, TCP_PORT);
			mTcp.SocketConnected += Tcp_SocketConnected;

			ZoneManager = new ZoneManager();
		}