Class ServerStorageService
- Namespace
- McServerLauncher.Services
- Assembly
- McServerLauncher.dll
Loads and saves the list of registered servers in %APPDATA%\McServerLauncher\servers.json.
public class ServerStorageService
- Inheritance
-
ServerStorageService
- Inherited Members
Constructors
ServerStorageService()
public ServerStorageService()
Properties
LastLoadOutcome
What happened with servers.json on the last Load(). Anything other than Ok should be surfaced to the user (the UI does it on startup) instead of silently showing an empty server list.
public AtomicJsonFile.LoadOutcome LastLoadOutcome { get; }
Property Value
QuarantinedFilePath
Where a corrupt servers.json is preserved (the ".bad" quarantine file).
public string QuarantinedFilePath { get; }
Property Value
Methods
Load()
Loads the list of servers. Returns an empty list if there is no file. If the file is corrupt, the last good ".bak" copy is restored when possible (see AtomicJsonFile); check LastLoadOutcome for what happened.
public List<ServerConfig> Load()
Returns
Save(IEnumerable<ServerConfig>)
Saves the list of servers (atomically; the previous version is kept as ".bak").
public void Save(IEnumerable<ServerConfig> servers)
Parameters
serversIEnumerable<ServerConfig>