mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Fixed logs on map.
This commit is contained in:
parent
fbf6810c5c
commit
8eaa920751
@ -23,7 +23,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
|
|
||||||
if (!File.Exists("./map_config.ini"))
|
if (!File.Exists("./map_config.ini"))
|
||||||
{
|
{
|
||||||
Program.Log.Error("[FILE NOT FOUND]");
|
Program.Log.Error("FILE NOT FOUND");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,9 +39,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
ConfigConstants.DATABASE_NAME = configIni.GetValue("Database", "database", "");
|
ConfigConstants.DATABASE_NAME = configIni.GetValue("Database", "database", "");
|
||||||
ConfigConstants.DATABASE_USERNAME = configIni.GetValue("Database", "username", "");
|
ConfigConstants.DATABASE_USERNAME = configIni.GetValue("Database", "username", "");
|
||||||
ConfigConstants.DATABASE_PASSWORD = configIni.GetValue("Database", "password", "");
|
ConfigConstants.DATABASE_PASSWORD = configIni.GetValue("Database", "password", "");
|
||||||
|
|
||||||
Program.Log.Info("[OK]");
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,87 +1,85 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using FFXIVClassic_Map_Server.dataobjects;
|
using FFXIVClassic_Map_Server.dataobjects;
|
||||||
using FFXIVClassic.Common;
|
using FFXIVClassic.Common;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NLog.Targets;
|
using NLog.Targets;
|
||||||
using NLog.Targets.Wrappers;
|
using NLog.Targets.Wrappers;
|
||||||
using NLog.Config;
|
using NLog.Config;
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server
|
namespace FFXIVClassic_Map_Server
|
||||||
{
|
{
|
||||||
class Program
|
class Program
|
||||||
{
|
{
|
||||||
public static Logger Log;
|
public static Logger Log;
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
|
||||||
// set up logging
|
// set up logging
|
||||||
Log = LogManager.GetCurrentClassLogger();
|
Log = LogManager.GetCurrentClassLogger();
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
TextWriterTraceListener myWriter = new TextWriterTraceListener(System.Console.Out);
|
TextWriterTraceListener myWriter = new TextWriterTraceListener(System.Console.Out);
|
||||||
Debug.Listeners.Add(myWriter);
|
Debug.Listeners.Add(myWriter);
|
||||||
#endif
|
#endif
|
||||||
bool startServer = true;
|
bool startServer = true;
|
||||||
|
|
||||||
Program.Log.Info("---------FFXIV 1.0 Map Server---------");
|
Console.ForegroundColor = ConsoleColor.Cyan;
|
||||||
|
Console.WriteLine("---------FFXIV 1.0 Map Server---------");
|
||||||
//Load Config
|
Console.ForegroundColor = ConsoleColor.Gray;
|
||||||
if (!ConfigConstants.Load())
|
|
||||||
startServer = false;
|
//Load Config
|
||||||
|
if (!ConfigConstants.Load())
|
||||||
Assembly assem = Assembly.GetExecutingAssembly();
|
startServer = false;
|
||||||
Version vers = assem.GetName().Version;
|
|
||||||
Program.Log.Info("Version: " + vers.ToString());
|
//Test DB Connection
|
||||||
|
Program.Log.Info("Testing DB connection... ");
|
||||||
//Test 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)))
|
||||||
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
|
||||||
{
|
{
|
||||||
try
|
conn.Open();
|
||||||
{
|
conn.Close();
|
||||||
conn.Open();
|
|
||||||
conn.Close();
|
Program.Log.Info("Connection ok.");
|
||||||
|
}
|
||||||
Program.Log.Info("Connection ok.");
|
catch (MySqlException e)
|
||||||
}
|
{
|
||||||
catch (MySqlException e)
|
Program.Log.Error(e.ToString());
|
||||||
{
|
startServer = false;
|
||||||
Program.Log.Error(e.ToString());
|
}
|
||||||
startServer = false;
|
}
|
||||||
}
|
|
||||||
}
|
//Check World ID
|
||||||
|
DBWorld thisWorld = Database.GetServer(ConfigConstants.DATABASE_WORLDID);
|
||||||
//Check World ID
|
if (thisWorld != null)
|
||||||
DBWorld thisWorld = Database.GetServer(ConfigConstants.DATABASE_WORLDID);
|
Program.Log.Info("Successfully pulled world info from DB. Server name is {0}.", thisWorld.name);
|
||||||
if (thisWorld != null)
|
else
|
||||||
Program.Log.Info("Successfully pulled world info from DB. Server name is {0}.", thisWorld.name);
|
Program.Log.Info("World info could not be retrieved from the DB. Welcome and MOTD will not be displayed.");
|
||||||
else
|
|
||||||
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)
|
||||||
//Start server if A-OK
|
{
|
||||||
if (startServer)
|
Server server = new Server();
|
||||||
{
|
CommandProcessor cp = new CommandProcessor(server.GetConnectedPlayerList());
|
||||||
Server server = new Server();
|
server.StartServer();
|
||||||
CommandProcessor cp = new CommandProcessor(server.GetConnectedPlayerList());
|
|
||||||
server.StartServer();
|
while (startServer)
|
||||||
|
{
|
||||||
while (startServer)
|
String input = Console.ReadLine();
|
||||||
{
|
Log.Info("[Console Input] " + input);
|
||||||
String input = Console.ReadLine();
|
cp.DoCommand(input, null);
|
||||||
Log.Info("[Console Input] " + input);
|
}
|
||||||
cp.DoCommand(input, null);
|
}
|
||||||
}
|
|
||||||
}
|
Program.Log.Info("Press any key to continue...");
|
||||||
|
Console.ReadKey();
|
||||||
Program.Log.Info("Press any key to continue...");
|
}
|
||||||
Console.ReadKey();
|
|
||||||
}
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -116,7 +116,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
Console.ForegroundColor = ConsoleColor.White;
|
Console.ForegroundColor = ConsoleColor.White;
|
||||||
Program.Log.Debug("Map Server has started @ {0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port);
|
Program.Log.Info("Map Server has started @ {0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port);
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
Console.ForegroundColor = ConsoleColor.Gray;
|
||||||
|
|
||||||
mProcessor = new PacketProcessor(this, mConnectedPlayerList, mConnectionList);
|
mProcessor = new PacketProcessor(this, mConnectedPlayerList, mConnectionList);
|
||||||
|
Loading…
Reference in New Issue
Block a user