Re-implemented server state machine. Cleaned up code

TODO: Handle trigger errors
This commit is contained in:
2025-02-12 23:02:00 +01:00
parent 4088bfaef5
commit f45699f300
44 changed files with 913 additions and 831 deletions

View File

@@ -1,20 +1,21 @@
using MoonlightServers.DaemonShared.Enums;
using MoonlightServers.Shared.Enums;
using ServerState = MoonlightServers.Shared.Enums.ServerState;
namespace MoonlightServers.ApiServer.Extensions;
public static class ServerStateExtensions
{
public static ServerPowerState ToServerPowerState(this ServerState state)
public static ServerState ToServerPowerState(this DaemonShared.Enums.ServerState state)
{
return state switch
{
ServerState.Installing => ServerPowerState.Installing,
ServerState.Stopping => ServerPowerState.Stopping,
ServerState.Online => ServerPowerState.Online,
ServerState.Starting => ServerPowerState.Starting,
ServerState.Offline => ServerPowerState.Offline,
_ => ServerPowerState.Offline
DaemonShared.Enums.ServerState.Installing => ServerState.Installing,
DaemonShared.Enums.ServerState.Stopping => ServerState.Stopping,
DaemonShared.Enums.ServerState.Online => ServerState.Online,
DaemonShared.Enums.ServerState.Starting => ServerState.Starting,
DaemonShared.Enums.ServerState.Offline => ServerState.Offline,
_ => ServerState.Offline
};
}
}