2016-06-08 22:29:04 +01:00
|
|
|
|
using System;
|
2015-08-26 13:38:58 -04:00
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using MySql.Data.MySqlClient;
|
2016-06-14 05:09:30 +01:00
|
|
|
|
using NLog;
|
2015-08-26 13:38:58 -04:00
|
|
|
|
namespace FFXIVClassic_Lobby_Server
|
|
|
|
|
{
|
|
|
|
|
class Program
|
|
|
|
|
{
|
2016-06-14 05:09:30 +01:00
|
|
|
|
public static Logger Log;
|
2016-06-12 20:12:59 +01:00
|
|
|
|
|
2015-08-26 13:38:58 -04:00
|
|
|
|
static void Main(string[] args)
|
2016-06-17 05:05:31 +01:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// set up logging
|
2016-06-15 19:14:21 +01:00
|
|
|
|
Log = LogManager.GetCurrentClassLogger();
|
2015-08-26 13:38:58 -04:00
|
|
|
|
#if DEBUG
|
|
|
|
|
TextWriterTraceListener myWriter = new TextWriterTraceListener(System.Console.Out);
|
2016-06-17 05:05:31 +01:00
|
|
|
|
Debug.Listeners.Add(myWriter);
|
2015-08-26 13:38:58 -04:00
|
|
|
|
#endif
|
2017-07-06 22:30:03 -05:00
|
|
|
|
Log.Info("==================================");
|
|
|
|
|
Log.Info("FFXIV Classic Lobby Server");
|
2017-08-26 14:00:40 -04:00
|
|
|
|
Log.Info("Version: 0.1");
|
2017-07-06 22:30:03 -05:00
|
|
|
|
Log.Info("==================================");
|
2016-06-15 10:40:30 -04:00
|
|
|
|
|
2015-08-26 13:38:58 -04:00
|
|
|
|
bool startServer = true;
|
|
|
|
|
|
|
|
|
|
//Load Config
|
2016-12-04 21:41:34 +00:00
|
|
|
|
ConfigConstants.Load();
|
|
|
|
|
ConfigConstants.ApplyLaunchArgs(args);
|
2016-06-15 10:40:30 -04:00
|
|
|
|
|
2015-08-26 13:38:58 -04:00
|
|
|
|
//Test DB Connection
|
2016-06-14 05:09:30 +01:00
|
|
|
|
Program.Log.Info("Testing DB connection to \"{0}\"... ", ConfigConstants.DATABASE_HOST);
|
2015-08-26 13:38:58 -04:00
|
|
|
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
conn.Close();
|
2016-06-08 22:29:04 +01:00
|
|
|
|
|
2016-06-15 10:40:30 -04:00
|
|
|
|
Program.Log.Info("Connection ok.");
|
2015-08-26 13:38:58 -04:00
|
|
|
|
}
|
|
|
|
|
catch (MySqlException e)
|
|
|
|
|
{
|
2016-06-15 10:40:30 -04:00
|
|
|
|
Program.Log.Error(e.ToString());
|
2015-08-26 13:38:58 -04:00
|
|
|
|
startServer = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Start Server if A-OK
|
|
|
|
|
if (startServer)
|
|
|
|
|
{
|
|
|
|
|
Server server = new Server();
|
2016-06-14 21:29:10 +01:00
|
|
|
|
server.StartServer();
|
2016-12-04 21:41:34 +00:00
|
|
|
|
while (true) Thread.Sleep(10000);
|
2015-08-26 13:38:58 -04:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-12 20:12:59 +01:00
|
|
|
|
Program.Log.Info("Press any key to continue...");
|
2015-08-26 13:38:58 -04:00
|
|
|
|
Console.ReadKey();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|