Ejemplo n.º 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();
            }
        }
Ejemplo n.º 2
0
 static void Main()
 {
     LoggingAPI.Init("Logs\\");
     LoggingAPI.LogEntry("Software started.");
     try
     {
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         Application.Run(new MainForm());
     }
     catch (Exception e)
     {
         LoggingAPI.Error(e);
     }
     LoggingAPI.LogEntry("Software shutdown.");
     LoggingAPI.FlushQueue();
 }