-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Quick-check mods for updates on server startup using workshop item up…
…dated date (#96) * Implement quick mods update to run before server startup * Fix incorrect media type error when making request without JSON body * Remove verifyMods from status * Perform mods verification during preparation for upcoming missions * Fix missing mods not returned as needing update
- Loading branch information
Showing
17 changed files
with
379 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
ArmaForces.ArmaServerManager/Features/Status/AppStatusStore.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using ArmaForces.ArmaServerManager.Api.Status.DTOs; | ||
using ArmaForces.ArmaServerManager.Features.Status.Models; | ||
|
||
namespace ArmaForces.ArmaServerManager.Features.Status; | ||
|
||
/// <summary> | ||
/// TODO: Consider doing this in a better way. For now it's fine. | ||
/// </summary> | ||
public class AppStatusStore : IAppStatusStore | ||
{ | ||
public AppStatusDetails? StatusDetails { get; private set; } | ||
|
||
public IDisposable SetAppStatus(AppStatus appStatus, string? longStatus = null) | ||
{ | ||
var previousStatus = StatusDetails; | ||
|
||
StatusDetails = new AppStatusDetails | ||
{ | ||
Status = appStatus, | ||
LongStatus = longStatus | ||
}; | ||
|
||
return new AppStatusDisposable(this, previousStatus); | ||
} | ||
|
||
public void ClearAppStatus() | ||
{ | ||
StatusDetails = null; | ||
} | ||
|
||
private class AppStatusDisposable : IDisposable | ||
{ | ||
private readonly AppStatusStore _appStatusStore; | ||
private readonly AppStatusDetails? _previousStatus; | ||
|
||
public AppStatusDisposable(AppStatusStore appStatusStore, AppStatusDetails? previousStatus) | ||
{ | ||
_appStatusStore = appStatusStore; | ||
_previousStatus = previousStatus; | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
_appStatusStore.StatusDetails = _previousStatus; | ||
} | ||
} | ||
} | ||
|
||
public interface IAppStatusStore | ||
{ | ||
AppStatusDetails? StatusDetails { get; } | ||
|
||
IDisposable SetAppStatus(AppStatus appStatus, string? longStatus = null); | ||
|
||
void ClearAppStatus(); | ||
} |
Oops, something went wrong.