Fix logs and configs not following -configpath param
This commit is contained in:
parent
4fd6276ec2
commit
97b6f77383
2 changed files with 18 additions and 10 deletions
|
|
@ -36,5 +36,5 @@ using System.Runtime.InteropServices;
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
|
|
||||||
[assembly: AssemblyVersion("3.3.4.1213")]
|
[assembly: AssemblyVersion("3.3.4.1215")]
|
||||||
[assembly: AssemblyFileVersion("3.3.4.1213")]
|
[assembly: AssemblyFileVersion("3.3.4.1215")]
|
||||||
|
|
|
||||||
|
|
@ -109,18 +109,19 @@ namespace TShockAPI
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")]
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")]
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(SavePath))
|
try
|
||||||
Directory.CreateDirectory(SavePath);
|
{
|
||||||
|
HandleCommandLine(Environment.GetCommandLineArgs());
|
||||||
|
|
||||||
|
if (!Directory.Exists(SavePath))
|
||||||
|
Directory.CreateDirectory(SavePath);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Log.Initialize(Path.Combine(SavePath, "log.txt"), LogLevel.All, false);
|
Log.Initialize(Path.Combine(SavePath, "log.txt"), LogLevel.All, false);
|
||||||
#else
|
#else
|
||||||
Log.Initialize(Path.Combine(SavePath, "log.txt"), LogLevel.All & ~LogLevel.Debug, false);
|
Log.Initialize(Path.Combine(SavePath, "log.txt"), LogLevel.All & ~LogLevel.Debug, false);
|
||||||
#endif
|
#endif
|
||||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
if (File.Exists(Path.Combine(SavePath, "tshock.pid")))
|
if (File.Exists(Path.Combine(SavePath, "tshock.pid")))
|
||||||
{
|
{
|
||||||
|
|
@ -132,7 +133,7 @@ namespace TShockAPI
|
||||||
ConfigFile.ConfigRead += OnConfigRead;
|
ConfigFile.ConfigRead += OnConfigRead;
|
||||||
FileTools.SetupConfig();
|
FileTools.SetupConfig();
|
||||||
|
|
||||||
HandleCommandLine(Environment.GetCommandLineArgs());
|
HandleCommandLine_Port(Environment.GetCommandLineArgs());
|
||||||
|
|
||||||
if (Config.StorageType.ToLower() == "sqlite")
|
if (Config.StorageType.ToLower() == "sqlite")
|
||||||
{
|
{
|
||||||
|
|
@ -384,6 +385,13 @@ namespace TShockAPI
|
||||||
Log.ConsoleInfo("World path has been set to " + path);
|
Log.ConsoleInfo("World path has been set to " + path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleCommandLine_Port(string[] parms)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < parms.Length; i++)
|
||||||
|
{
|
||||||
if (parms[i].ToLower() == "-port")
|
if (parms[i].ToLower() == "-port")
|
||||||
{
|
{
|
||||||
int port = Convert.ToInt32(parms[++i]);
|
int port = Convert.ToInt32(parms[++i]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue