Add temporary autostart flag for restart commands and autostart commandline switch (#382)
Co-authored-by: Jimmacle <mindstorms11@cox.net>
This commit is contained in:
@@ -144,9 +144,12 @@ quit";
|
|||||||
var gameThread = new Thread(() =>
|
var gameThread = new Thread(() =>
|
||||||
{
|
{
|
||||||
_server.Init();
|
_server.Init();
|
||||||
|
|
||||||
if (_config.Autostart)
|
if (_config.Autostart || _config.TempAutostart)
|
||||||
|
{
|
||||||
|
_config.TempAutostart = false;
|
||||||
_server.Start();
|
_server.Start();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gameThread.Start();
|
gameThread.Start();
|
||||||
|
@@ -62,10 +62,17 @@ namespace Torch.Server
|
|||||||
[XmlIgnore, Arg("forceupdate", "Manually check for and install updates.")]
|
[XmlIgnore, Arg("forceupdate", "Manually check for and install updates.")]
|
||||||
public bool ForceUpdate { get; set; }
|
public bool ForceUpdate { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <summary>
|
||||||
[Arg("autostart", "Start the server immediately.")]
|
/// Permanent flag to ALWAYS automatically start the server
|
||||||
|
/// </summary>
|
||||||
public bool Autostart { get; set; }
|
public bool Autostart { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Temporary flag to automatically start the server only on the next run
|
||||||
|
/// </summary>
|
||||||
|
[Arg("autostart", "Start the server immediately.")]
|
||||||
|
public bool TempAutostart { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[Arg("restartoncrash", "Automatically restart the server if it crashes.")]
|
[Arg("restartoncrash", "Automatically restart the server if it crashes.")]
|
||||||
public bool RestartOnCrash { get; set; }
|
public bool RestartOnCrash { get; set; }
|
||||||
|
@@ -212,7 +212,7 @@ namespace Torch.Server
|
|||||||
string exe = Assembly.GetExecutingAssembly().Location;
|
string exe = Assembly.GetExecutingAssembly().Location;
|
||||||
Debug.Assert(exe != null);
|
Debug.Assert(exe != null);
|
||||||
config.WaitForPID = Process.GetCurrentProcess().Id.ToString();
|
config.WaitForPID = Process.GetCurrentProcess().Id.ToString();
|
||||||
config.Autostart = true;
|
config.TempAutostart = true;
|
||||||
Process.Start(exe, config.ToString());
|
Process.Start(exe, config.ToString());
|
||||||
|
|
||||||
Process.GetCurrentProcess().Kill();
|
Process.GetCurrentProcess().Kill();
|
||||||
|
Reference in New Issue
Block a user