mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-08 05:24:34 +02:00
PROJECT: added common library to make common files actually common
- renamed sln to FFXIVClassic.sln - threaded logging - todo: print packets using Log.Packet
This commit is contained in:
parent
16d4779970
commit
c23f9c7ca9
53 changed files with 547 additions and 1817 deletions
|
@ -1,14 +1,17 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using MySql.Data.MySqlClient;
|
||||
using System.Reflection;
|
||||
using FFXIVClassic_Map_Server.dataobjects;
|
||||
using FFXIVClassic_Map_Server.common;
|
||||
using FFXIVClassic.Common;
|
||||
|
||||
namespace FFXIVClassic_Map_Server
|
||||
{
|
||||
class Program
|
||||
{
|
||||
public static Log Log;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
#if DEBUG
|
||||
|
@ -21,14 +24,29 @@ namespace FFXIVClassic_Map_Server
|
|||
if (!ConfigConstants.load())
|
||||
startServer = false;
|
||||
|
||||
Log.Info("---------FFXIV 1.0 Map Server---------");
|
||||
Log = new Log(ConfigConstants.OPTIONS_LOGPATH, ConfigConstants.OPTIONS_LOGFILE, Int32.Parse(ConfigConstants.OPTIONS_LOGLEVEL));
|
||||
|
||||
Thread thread = new Thread(() =>
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (Log.LogQueue.Count > 0)
|
||||
{
|
||||
var message = Program.Log.LogQueue.Dequeue();
|
||||
Program.Log.WriteMessage(message.Item1, message.Item2);
|
||||
}
|
||||
}
|
||||
});
|
||||
thread.Start();
|
||||
|
||||
Program.Log.Info("---------FFXIV 1.0 Map Server---------");
|
||||
|
||||
Assembly assem = Assembly.GetExecutingAssembly();
|
||||
Version vers = assem.GetName().Version;
|
||||
Log.Info("Version: " + vers.ToString());
|
||||
Program.Log.Info("Version: " + vers.ToString());
|
||||
|
||||
//Test DB Connection
|
||||
Log.Info("Testing DB connection... ");
|
||||
Program.Log.Info("Testing DB connection... ");
|
||||
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
|
||||
|
@ -36,11 +54,11 @@ namespace FFXIVClassic_Map_Server
|
|||
conn.Open();
|
||||
conn.Close();
|
||||
|
||||
Log.Status("[OK]");
|
||||
Program.Log.Status("[OK]");
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
Log.Error(e.ToString());
|
||||
Program.Log.Error(e.ToString());
|
||||
startServer = false;
|
||||
}
|
||||
}
|
||||
|
@ -48,9 +66,9 @@ namespace FFXIVClassic_Map_Server
|
|||
//Check World ID
|
||||
DBWorld thisWorld = Database.getServer(ConfigConstants.DATABASE_WORLDID);
|
||||
if (thisWorld != null)
|
||||
Log.Info(String.Format("Successfully pulled world info from DB. Server name is {0}.", thisWorld.name));
|
||||
Program.Log.Info(String.Format("Successfully pulled world info from DB. Server name is {0}.", thisWorld.name));
|
||||
else
|
||||
Log.Info("World info could not be retrieved from the DB. Welcome and MOTD will not be displayed.");
|
||||
Program.Log.Info("World info could not be retrieved from the DB. Welcome and MOTD will not be displayed.");
|
||||
|
||||
//Start server if A-OK
|
||||
if (startServer)
|
||||
|
@ -66,7 +84,7 @@ namespace FFXIVClassic_Map_Server
|
|||
}
|
||||
}
|
||||
|
||||
Log.Info("Press any key to continue...");
|
||||
Program.Log.Info("Press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue