mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-09 05:54:50 +02:00
Cleaned up namespaces (still have to do Map Project) and removed references to FFXIV Classic from the code. Removed the Launcher Editor project as it is no longer needed (host file editing is cleaner).
This commit is contained in:
parent
7587a6e142
commit
0f61c4c0e1
544 changed files with 54548 additions and 55498 deletions
112
World Server/Program.cs
Normal file
112
World Server/Program.cs
Normal file
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015-2019 Project Meteor Dev Team
|
||||
|
||||
This file is part of Project Meteor Server.
|
||||
|
||||
Project Meteor Server is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Project Meteor Server is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
using NLog;
|
||||
using Meteor.World.DataObjects;
|
||||
using MySql.Data.MySqlClient;
|
||||
|
||||
namespace Meteor.World
|
||||
{
|
||||
class Program
|
||||
{
|
||||
public static Logger Log;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// set up logging
|
||||
Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
bool startServer = true;
|
||||
|
||||
Log.Info("==================================");
|
||||
Log.Info("FFXIV Classic World Server");
|
||||
Log.Info("Version: 0.1");
|
||||
Log.Info("==================================");
|
||||
|
||||
#if DEBUG
|
||||
TextWriterTraceListener myWriter = new TextWriterTraceListener(System.Console.Out);
|
||||
Debug.Listeners.Add(myWriter);
|
||||
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
System.Threading.Thread.Sleep(5000);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//Load Config
|
||||
ConfigConstants.Load();
|
||||
ConfigConstants.ApplyLaunchArgs(args);
|
||||
|
||||
//Test DB Connection
|
||||
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
|
||||
{
|
||||
conn.Open();
|
||||
conn.Close();
|
||||
|
||||
Log.Info("Connection ok.");
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
Log.Error(e.ToString());
|
||||
startServer = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Check World ID
|
||||
DBWorld thisWorld = Database.GetServer(ConfigConstants.DATABASE_WORLDID);
|
||||
if (thisWorld != null)
|
||||
{
|
||||
Program.Log.Info("Successfully pulled world info from DB. Server name is {0}.", thisWorld.name);
|
||||
ConfigConstants.PREF_SERVERNAME = thisWorld.name;
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.Log.Info("World info could not be retrieved from the DB. Welcome and MOTD will not be displayed.");
|
||||
ConfigConstants.PREF_SERVERNAME = "Unknown";
|
||||
}
|
||||
|
||||
//Start server if A-OK
|
||||
if (startServer)
|
||||
{
|
||||
Server server = new Server();
|
||||
server.StartServer();
|
||||
|
||||
while (startServer)
|
||||
{
|
||||
String input = Console.ReadLine();
|
||||
Log.Info("[Console Input] " + input);
|
||||
//cp.DoCommand(input, null);
|
||||
}
|
||||
}
|
||||
|
||||
Program.Log.Info("Press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue