Merge branch 'develop' into group_work

# Conflicts:
#	FFXIVClassic Map Server/ConfigConstants.cs
This commit is contained in:
Filip Maj 2017-01-09 00:19:39 -05:00
commit 79de4fd1ff
14 changed files with 136 additions and 24 deletions

View file

@ -1,6 +1,8 @@
using FFXIVClassic.Common;
using System;
using System.IO;
using System.Linq;
using System.Net;
namespace FFXIVClassic_World_Server
{
@ -26,7 +28,7 @@ namespace FFXIVClassic_World_Server
if (!File.Exists("./world_config.ini"))
{
Program.Log.Error("FILE NOT FOUND!");
return false;
Program.Log.Error("Loading defaults...");
}
INIFile configIni = new INIFile("./world_config.ini");
@ -44,5 +46,35 @@ namespace FFXIVClassic_World_Server
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);
}
}
}
}
}

View file

@ -156,6 +156,9 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>xcopy "$(SolutionDir)data\world_config.ini" "$(SolutionDir)$(ProjectName)\$(OutDir)" /d</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View file

@ -39,8 +39,8 @@ namespace FFXIVClassic_World_Server
#endif
//Load Config
if (!ConfigConstants.Load())
startServer = false;
ConfigConstants.Load();
ConfigConstants.ApplyLaunchArgs(args);
//Test DB Connection
Log.Info("Testing DB connection... ");