![]() |
fCraft
0.638
Custom Minecraft Server
|
Static class that handles loading/saving configuration, contains config defaults, and various configuration-related utilities. More...
Static Public Member Functions | |
| static void | LoadDefaults () |
| Overwrites current settings with defaults. | |
| static void | LoadDefaults (ConfigSection section) |
| Loads defaults for keys in a given ConfigSection. | |
| static bool | IsDefault (this ConfigKey key) |
| Checks whether given ConfigKey still has its default value. | |
| static object | GetDefault (this ConfigKey key) |
| Provides the default value for a given ConfigKey. | |
| static void | ResetLogOptions () |
| static void | Load (bool skipRankList, bool raiseReloadedEvent) |
| Loads configuration from file. | |
| static bool | Save () |
| static bool | IsBlank (this ConfigKey key) |
| Checks whether any value has been set for a given key. | |
| static string | GetString (this ConfigKey key) |
| Returns raw value for the given key. | |
| static int | GetInt (this ConfigKey key) |
| Attempts to parse given key's value as an integer. Throws a FormatException on failure. | |
| static bool | TryGetInt (this ConfigKey key, out int result) |
| Attempts to parse a given key's value as an integer. | |
| static TEnum | GetEnum< TEnum > (this ConfigKey key) |
| Attempts to parse a given key's value as an enumeration. An ArgumentException is thrown if value could not be parsed. Note the parsing is done in a case-insensitive way. | |
| static bool | Enabled (this ConfigKey key) |
| Attempts to parse given key's value as a boolean. Throws a FormatException on failure. | |
| static bool | TryGetBool (this ConfigKey key, out bool result) |
| Attempts to parse a given key's value as a boolean. | |
| static Type | GetValueType (this ConfigKey key) |
| Returns the expected Type of the key's value, as specified in key metadata. | |
| static ConfigKeyAttribute | GetMetadata (this ConfigKey key) |
| Returns the metadata container (ConfigKeyAttribute object) for a given key. | |
| static ConfigSection | GetSection (this ConfigKey key) |
| Returns the ConfigSection that a given key is associated with. | |
| static string | GetDescription (this ConfigKey key) |
| Returns the description text for a given config key. | |
| static bool | ResetValue (this ConfigKey key) |
| Resets key value to its default setting. | |
| static bool | SetValue (this ConfigKey key, object rawValue) |
| Sets value of a given config key. Note that this method may throw exceptions if the given value is not acceptable. Use Config.TrySetValue() if you'd like to suppress exceptions in favor of a boolean return value. | |
| static bool | TrySetValue (this ConfigKey key, object rawValue) |
| Attempts to set the value of a given config key. Check the return value to make sure that the given value was acceptable. | |
| static void | ResetRanks () |
| Resets the list of ranks to defaults (guest/builder/op/owner). Warning: This method is not thread-safe, and should never be used on a live server. | |
| static ConfigKey[] | GetKeys (this ConfigSection section) |
| Returns a list of all keys in a section. | |
Public Attributes | |
| const int | ProtocolVersion = 7 |
| Supported version of the Minecraft classic protocol. | |
| const int | CurrentVersion = 164 |
| Latest version of config.xml available at the time of building this copy of fCraft. Config.xml files saved with this build will have this version number embedded. | |
Events | |
| static EventHandler | Reloaded |
| Occurs after the entire configuration has been reloaded from file. | |
| static EventHandler < ConfigKeyChangingEventArgs > | KeyChanging |
| Occurs when a config key is about to be changed (cancelable). The new value may be replaced by the callback. | |
| static EventHandler < ConfigKeyChangedEventArgs > | KeyChanged |
| Occurs after a config key has been changed. | |
Static class that handles loading/saving configuration, contains config defaults, and various configuration-related utilities.
|
static |
Attempts to parse given key's value as a boolean. Throws a FormatException on failure.
|
static |
Provides the default value for a given ConfigKey.
|
static |
Returns the description text for a given config key.
|
static |
Attempts to parse a given key's value as an enumeration. An ArgumentException is thrown if value could not be parsed. Note the parsing is done in a case-insensitive way.
| TEnum | Enum to use for parsing. An ArgumentException will be thrown if this is not an enum. |
| ArgumentException | TEnum is not an System.Enum. -or- key value is either an empty string ("") or only contains white space. -or- value is a name, but not one of the named constants defined for the enumeration. |
| TEnum | : | struct |
|
static |
Attempts to parse given key's value as an integer. Throws a FormatException on failure.
|
static |
Returns a list of all keys in a section.
|
static |
Returns the metadata container (ConfigKeyAttribute object) for a given key.
|
static |
Returns the ConfigSection that a given key is associated with.
|
static |
Returns raw value for the given key.
|
static |
Returns the expected Type of the key's value, as specified in key metadata.
|
static |
Checks whether any value has been set for a given key.
|
static |
Checks whether given ConfigKey still has its default value.
|
static |
Loads configuration from file.
| skipRankList | If true, skips over rank definitions. |
| raiseReloadedEvent | Whether ConfigReloaded event should be raised. |
|
static |
Overwrites current settings with defaults.
|
static |
Loads defaults for keys in a given ConfigSection.
|
static |
|
static |
Resets the list of ranks to defaults (guest/builder/op/owner). Warning: This method is not thread-safe, and should never be used on a live server.
|
static |
Resets key value to its default setting.
| key | Config key to reset. |
|
static |
|
static |
Sets value of a given config key. Note that this method may throw exceptions if the given value is not acceptable. Use Config.TrySetValue() if you'd like to suppress exceptions in favor of a boolean return value.
| key | Config key to set. |
| rawValue | Value to assign to the key. If passed object is not a string, rawValue.ToString() is used. |
| ArgumentNullException | rawValue is null. |
| NullReferenceException | rawValue.ToString() is null. |
| FormatException | Given value did not satisfy key's requirements. |
|
static |
Attempts to parse a given key's value as a boolean.
| key | ConfigKey to get value from. |
| result | Will be set to the value on success, or to false on failure. |
|
static |
Attempts to parse a given key's value as an integer.
| key | ConfigKey to get value from. |
| result | Will be set to the value on success, or to 0 on failure. |
|
static |
Attempts to set the value of a given config key. Check the return value to make sure that the given value was acceptable.
| key | Config key to set. |
| rawValue | Value to assign to the key. If passed object is not a string, rawValue.ToString() is used. |
| T:System.ArgumentNullException |
|
| const int fCraft.Config.CurrentVersion = 164 |
Latest version of config.xml available at the time of building this copy of fCraft. Config.xml files saved with this build will have this version number embedded.
| const int fCraft.Config.ProtocolVersion = 7 |
Supported version of the Minecraft classic protocol.
|
static |
Occurs after a config key has been changed.
|
static |
Occurs when a config key is about to be changed (cancelable). The new value may be replaced by the callback.
|
static |
Occurs after the entire configuration has been reloaded from file.