Table of Contents

Interface IServerConfiguration

Namespace
FishMMO.Server.Core
Assembly
FishMMO.Server.dll

Interface for a service that manages server configuration. Provides methods to retrieve and save configuration values for different server types.

public interface IServerConfiguration

Methods

GetInt(string, int)

Retrieves an integer value from the configuration.

int GetInt(string key, int defaultValue)

Parameters

key string

The configuration key.

defaultValue int

The default value to return if the key is not found.

Returns

int

The integer value associated with the key, or the default value if not found.

GetString(string, string)

Retrieves a string value from the configuration.

string GetString(string key, string defaultValue)

Parameters

key string

The configuration key.

defaultValue string

The default value to return if the key is not found.

Returns

string

The string value associated with the key, or the default value if not found.

GetUShort(string, ushort)

Retrieves an unsigned short value from the configuration.

ushort GetUShort(string key, ushort defaultValue)

Parameters

key string

The configuration key.

defaultValue ushort

The default value to return if the key is not found.

Returns

ushort

The ushort value associated with the key, or the default value if not found.

SaveDefaultsIfMissing(string, string, string)

Saves default configuration values if they are missing for the specified server type and working directory.

void SaveDefaultsIfMissing(string serverTypeName, string serverType, string workingDirectory)

Parameters

serverTypeName string

The name of the server type.

serverType string

The type of the server.

workingDirectory string

The working directory for the server.

TryGetInt(string, out int)

Attempts to retrieve an integer value from the configuration for the specified key.

bool TryGetInt(string key, out int value)

Parameters

key string

The configuration key to look up.

value int

When this method returns true, contains the integer value associated with key; otherwise 0 (or the default provided by the underlying implementation).

Returns

bool

true if the key exists and a value was retrieved; otherwise false.

TryGetString(string, out string)

Attempts to retrieve a string value from the configuration for the specified key.

bool TryGetString(string key, out string value)

Parameters

key string

The configuration key to look up.

value string

When this method returns true, contains the string value associated with key; otherwise null or an empty string as provided by the underlying implementation.

Returns

bool

true if the key exists and a value was retrieved; otherwise false.

TryGetUShort(string, out ushort)

Attempts to retrieve an unsigned short value from the configuration for the specified key.

bool TryGetUShort(string key, out ushort value)

Parameters

key string

The configuration key to look up.

value ushort

When this method returns true, contains the ushort value associated with key; otherwise 0 (or the default provided by the underlying implementation).

Returns

bool

true if the key exists and a value was retrieved; otherwise false.