Skip to content

Commit 82faa02

Browse files
authored
re-implement game update manager (#560)
1 parent 3f5c967 commit 82faa02

4 files changed

Lines changed: 21 additions & 1 deletion

File tree

‎Torch.API/ITorchConfig.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public interface ITorchConfig
3333
bool SendLogsToKeen { get; set; }
3434
bool DeleteMiniDumps { get; set; }
3535
string LoginToken { get; set; }
36+
bool RestartOnGameUpdate { get; set; }
37+
int GameUpdateRestartDelayMins { get; set; }
3638

3739
void Save(string path = null);
3840
}

‎Torch.Server/Torch.Server.csproj‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@
245245
<Compile Include="FlowDocumentTarget.cs" />
246246
<Compile Include="ListBoxExtensions.cs" />
247247
<Compile Include="Managers\EntityControlManager.cs" />
248+
<Compile Include="Managers\GameUpdateManager.cs" />
248249
<Compile Include="Managers\MultiplayerManagerDedicated.cs" />
249250
<Compile Include="Managers\InstanceManager.cs" />
250251
<Compile Include="Managers\MultiplayerManagerDedicatedEventShim.cs" />

‎Torch.Server/TorchConfig.cs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public class TorchConfig : CommandLine, ITorchConfig, INotifyPropertyChanged
2525
private string _instanceName = "Instance";
2626
private bool _autostart;
2727
private bool _restartOnCrash;
28+
private bool _restartOnGameUpdate;
29+
private int _gameUpdateRestartDelayMins = 5;
2830
private bool _noGui;
2931
private bool _getPluginUpdates = true;
3032
private bool _getTorchUpdates = true;
@@ -86,6 +88,20 @@ public string InstancePath
8688
[Arg("restartoncrash", "Automatically restart the server if it crashes.")]
8789
[Display(Name = "Restart On Crash", Description = "Automatically restart the server if it crashes.", GroupName = "Server")]
8890
public bool RestartOnCrash { get => _restartOnCrash; set => Set(value, ref _restartOnCrash); }
91+
92+
/// <summary>
93+
/// Enable Game update detection. If enabled, server will restart when game updates are found.
94+
/// </summary>
95+
[Arg("gameupdatedetection", "Automatically restart the server if the game updates.")]
96+
[Display(Name = "Restart On Game Update", Description = "Automatically restart the server if the game updates.", GroupName = "Update Detection")]
97+
public bool RestartOnGameUpdate { get => _restartOnGameUpdate; set => Set(value, ref _restartOnGameUpdate); }
98+
99+
/// <summary>
100+
/// How long (in minutes) to wait before restarting after a game update is detected.
101+
/// </summary>
102+
[Arg("gameupdaterestartdelay", "How long (in minutes) to wait before restarting after a game update is detected.")]
103+
[Display(Name = "Game Update Restart Delay", Description = "How long (in minutes) to wait before restarting after a game update is detected.", GroupName = "Update Detection")]
104+
public int GameUpdateRestartDelayMins { get => _gameUpdateRestartDelayMins; set => Set(value, ref _gameUpdateRestartDelayMins); }
89105

90106
/// <inheritdoc />
91107
[Arg("nogui", "Do not show the Torch UI.")]

‎Torch.Server/TorchServer.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ public TorchServer(TorchConfig config) : base(config)
6767
AddManager(new EntityControlManager(this));
6868
AddManager(new RemoteAPIManager(this));
6969
AddManager(new UpdateManager(this));
70-
70+
AddManager(new GameUpdateManager(this));
71+
7172
Managers.GetManager<UpdateManager>().CheckAndUpdateTorch();
7273

7374
var sessionManager = Managers.GetManager<ITorchSessionManager>();

0 commit comments

Comments
 (0)