/* Thor Server 2.0 Project - Codenamed "Stockholm" Copyright 2008 - 2009 Joe Hegarty This file is part of The Thor Server 2.0 Project - Codenamed "Stockholm". The Thor Server 2.0 Project - Codenamed "Stockholm" is free software: you can redistribute it and/or modify it under the terms of the Microsoft Public License The Thor Server Project is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Microsoft Public License for more details. You should have received a copy of the Microsoft Public License along with The Thor Server Project. If not, see http://www.opensource.org/licenses/ms-pl.html */ using System; using System.Threading; using StockholmLibrary.Util; namespace StockholmLibrary { //------------------------------------ public class Stockholm { private static Stockholm _stockholm = null; private Net.ConnectionManager _connectionManager; private Net.PacketManager _packetManager; private Game.GameManager _gameManager; private Data.DataManager _dataManager; private bool _isRunning = true; //********************************************** public static Stockholm Get() { if (_stockholm == null) { _stockholm = new Stockholm(); } return _stockholm; } //********************************************** public Net.ConnectionManager ConnectionManager { get { return _connectionManager; } } //********************************************** public Net.PacketManager PacketManager { get { return _packetManager; } } //********************************************** public bool IsRunning { get { return _isRunning; } set { _isRunning = value; } } //********************************************** public Game.GameManager GameManager { get { return _gameManager; } } //********************************************** public Data.StockholmDbDataContext Database { get { return _dataManager.Database; } } //********************************************** public void StartStockholm(int portNumber, string databaseServer, string databaseName, string databaseUser, string databasePassword) { Console.Title = "Thor 2.0 - Codename \"Stockholm\""; Logging.WriteRaw("***********************************"); Logging.WriteRaw("Thor 2.0 - Codename \"Stockholm\" - for Habbo Hotel V9"); Logging.WriteRaw("Copyright 2009 Joe Hegarty"); Logging.WriteRaw("***********************************"); Logging.WriteRaw(""); Thread.CurrentThread.Name = "AppThread"; Logging.LogEvent("StockholmCore", "AppThread started successfully", Logging.ELogLevel.INFO); _dataManager = new Data.DataManager(databaseServer, databaseName, databaseUser, databasePassword); _packetManager = new Net.PacketManager(); _gameManager = new Game.GameManager(); _connectionManager = new Net.ConnectionManager(); _connectionManager.StartListening(portNumber); Logging.LogEvent("StockholmCore", "Server started succesfully", Logging.ELogLevel.INFO); } } }