Re-implemented server state machine. Cleaned up code
TODO: Handle trigger errors
This commit is contained in:
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user