Beispiel #1
0
        public static void Main(string[] args)
        {
            Console.Clear();
            Console.WriteLine("SixNet BBS, Starting up...");
            _bbsDatabaseConfiguration = BBSDatabaseConfiguration.LoadConfig("./");
            if (_bbsDatabaseConfiguration == null)
            {
                Console.WriteLine("Run setup utility first.");
                return;
            }
            _connectionString = BBSDatabaseConfiguration.BuildConnectionString(_bbsDatabaseConfiguration);
            LoggingAPI.Init("./Logs/");
            if (BBSDatabaseConfiguration.IsDatabaseSetup(_connectionString))
            {
                Console.WriteLine("Database configured.");
                _core = new BBSDataCore(_connectionString);
            }
            else
            {
                Console.WriteLine("Database not configured - run setup utility.");
                return;
            }
            var config = _core.GetBBSConfig();

            LoggingAPI.LogEntry("Software started.");
            try
            {
                quitFlag = false;
                BBSServer bbsServer = new BBSServer(_connectionString, config.BBSPort, "BBS Server");
                bbsServer.Start();
                while (!quitFlag)
                {
                    Thread.Sleep(100);
                    if (Console.KeyAvailable)
                    {
                        if (Console.ReadKey().Key == ConsoleKey.Q)
                        {
                            quitFlag = true;
                            bbsServer.Stop();
                            break;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                LoggingAPI.Error(e);
            }
            finally
            {
                LoggingAPI.LogEntry("Software shutdown.");
                LoggingAPI.FlushQueue();
            }
        }
Beispiel #2
0
        private static void SetupDatabase()
        {
            var dbServer       = Input("Enter your database server name", _bbsDatabaseConfiguration.DatabaseName);
            var dbDatabaseName = Input("Enter the database name", _bbsDatabaseConfiguration.DatabaseServer);
            var dbDatabaseUser = Input("Enter the database user", _bbsDatabaseConfiguration.DatabaseUsername);
            var dbDatabasePass = Input("Enter the database password", _bbsDatabaseConfiguration.DatabasePassword);

            _bbsDatabaseConfiguration.DatabaseName     = dbDatabaseName;
            _bbsDatabaseConfiguration.DatabaseServer   = dbServer;
            _bbsDatabaseConfiguration.DatabaseUsername = dbDatabaseUser;
            _bbsDatabaseConfiguration.DatabasePassword = dbDatabasePass;
            _connectionString = BBSDatabaseConfiguration.BuildConnectionString(_bbsDatabaseConfiguration);
        }
Beispiel #3
0
        public static void Main(string[] args)
        {
            Console.Clear();
            Console.WriteLine("SixNet Setup Utility");
            _bbsDatabaseConfiguration = BBSDatabaseConfiguration.LoadConfig(_basePath);
            if (_bbsDatabaseConfiguration == null)
            {
                _basePath = Input("BBS Base Path", _basePath);
                _bbsDatabaseConfiguration = BBSDatabaseConfiguration.LoadConfig(_basePath);
                if (_bbsDatabaseConfiguration == null)
                {
                    _bbsDatabaseConfiguration = new BBSDatabaseConfiguration();
                }
            }
            _connectionString = BBSDatabaseConfiguration.BuildConnectionString(_bbsDatabaseConfiguration);

            LoggingAPI.Init(_basePath);

            MainMenu();
        }