mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-07-29 13:56:17 +02:00
added launch args for ip/port and default config loading
- fixed char create issues by adding default values to fields (todo: fix actual query) - added post build command to copy scripts folder to bin
This commit is contained in:
parent
f286922974
commit
4a320d7096
13 changed files with 142 additions and 32 deletions
|
@ -1,6 +1,11 @@
|
|||
using FFXIVClassic.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Sockets;
|
||||
using MoonSharp.Interpreter.Interop;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
|
||||
namespace FFXIVClassic_Map_Server
|
||||
{
|
||||
|
@ -8,9 +13,9 @@ namespace FFXIVClassic_Map_Server
|
|||
{
|
||||
public static String OPTIONS_BINDIP;
|
||||
public static String OPTIONS_PORT;
|
||||
public static bool OPTIONS_TIMESTAMP = false;
|
||||
public static bool OPTIONS_TIMESTAMP = false;
|
||||
|
||||
public static uint DATABASE_WORLDID;
|
||||
public static uint DATABASE_WORLDID;
|
||||
public static String DATABASE_HOST;
|
||||
public static String DATABASE_PORT;
|
||||
public static String DATABASE_NAME;
|
||||
|
@ -24,23 +29,53 @@ namespace FFXIVClassic_Map_Server
|
|||
if (!File.Exists("./map_config.ini"))
|
||||
{
|
||||
Program.Log.Error("FILE NOT FOUND");
|
||||
return false;
|
||||
Program.Log.Error("Loading defaults... ");
|
||||
}
|
||||
|
||||
INIFile configIni = new INIFile("./map_config.ini");
|
||||
|
||||
ConfigConstants.OPTIONS_BINDIP = configIni.GetValue("General", "server_ip", "127.0.0.1");
|
||||
ConfigConstants.OPTIONS_PORT = configIni.GetValue("General", "server_port", "1989");
|
||||
ConfigConstants.OPTIONS_TIMESTAMP = configIni.GetValue("General", "showtimestamp", "true").ToLower().Equals("true");
|
||||
ConfigConstants.OPTIONS_BINDIP = configIni.GetValue("General", "server_ip", "127.0.0.1");
|
||||
ConfigConstants.OPTIONS_PORT = configIni.GetValue("General", "server_port", "1989");
|
||||
ConfigConstants.OPTIONS_TIMESTAMP = configIni.GetValue("General", "showtimestamp", "true").ToLower().Equals("true");
|
||||
|
||||
ConfigConstants.DATABASE_WORLDID = UInt32.Parse(configIni.GetValue("Database", "worldid", "0"));
|
||||
ConfigConstants.DATABASE_HOST = configIni.GetValue("Database", "host", "");
|
||||
ConfigConstants.DATABASE_PORT = configIni.GetValue("Database", "port", "");
|
||||
ConfigConstants.DATABASE_NAME = configIni.GetValue("Database", "database", "");
|
||||
ConfigConstants.DATABASE_USERNAME = configIni.GetValue("Database", "username", "");
|
||||
ConfigConstants.DATABASE_PASSWORD = configIni.GetValue("Database", "password", "");
|
||||
|
||||
ConfigConstants.DATABASE_WORLDID = UInt32.Parse(configIni.GetValue("Database", "worldid", "0"));
|
||||
ConfigConstants.DATABASE_HOST = configIni.GetValue("Database", "host", "");
|
||||
ConfigConstants.DATABASE_PORT = configIni.GetValue("Database", "port", "");
|
||||
ConfigConstants.DATABASE_NAME = configIni.GetValue("Database", "database", "");
|
||||
ConfigConstants.DATABASE_USERNAME = configIni.GetValue("Database", "username", "");
|
||||
ConfigConstants.DATABASE_PASSWORD = configIni.GetValue("Database", "password", "");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void ApplyLaunchArgs(string[] launchArgs)
|
||||
{
|
||||
var args = (from arg in launchArgs select arg.ToLower().Trim().TrimStart('-')).ToList();
|
||||
|
||||
for (var i = 0; i + 1 < args.Count; i += 2)
|
||||
{
|
||||
var arg = args[i];
|
||||
var val = args[i + 1];
|
||||
var legit = false;
|
||||
|
||||
if (arg == "ip")
|
||||
{
|
||||
IPAddress ip;
|
||||
if (IPAddress.TryParse(val, out ip) && (legit = true))
|
||||
OPTIONS_BINDIP = val;
|
||||
}
|
||||
else if (arg == "port")
|
||||
{
|
||||
UInt16 port;
|
||||
if (UInt16.TryParse(val, out port) && (legit = true))
|
||||
OPTIONS_PORT = val;
|
||||
}
|
||||
|
||||
if (!legit)
|
||||
{
|
||||
Program.Log.Error("Invalid parameter <{0}> for argument: <--{1}> or argument doesnt exist!", val, arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue