Table of Contents

Class BaseAlternateConfigurationFile

Namespace
Uncreated.Warfare.Configuration
Assembly
Uncreated.Warfare.dll

Allows deriving types to reference a configuration file.

public abstract class BaseAlternateConfigurationFile : IConfiguration, IDisposable
Inheritance
BaseAlternateConfigurationFile
Implements
Derived
Inherited Members
Extension Methods

Constructors

BaseAlternateConfigurationFile(string, bool)

Create a new configuration file reference.

protected BaseAlternateConfigurationFile(string fileName, bool mapSpecific = false)

Parameters

fileName string
mapSpecific bool

Will go in a "Maps/[map name]/" folder.

Properties

FilePath

Full path to the configuratin file.

public string FilePath { get; }

Property Value

string

this[string]

Gets or sets a configuration value.

public string? this[string key] { get; set; }

Parameters

key string

The configuration key.

Property Value

string

The configuration value.

UnderlyingConfiguration

The underlying configuration object.

public IConfiguration UnderlyingConfiguration { get; }

Property Value

IConfiguration

Methods

GetChildren()

Gets the immediate descendant configuration sub-sections.

public IEnumerable<IConfigurationSection> GetChildren()

Returns

IEnumerable<IConfigurationSection>

The configuration sub-sections.

GetReloadToken()

Returns a IChangeToken that can be used to observe when this configuration is reloaded.

public IChangeToken GetReloadToken()

Returns

IChangeToken

A IChangeToken.

GetSection(string)

Gets a configuration sub-section with the specified key.

public IConfigurationSection GetSection(string key)

Parameters

key string

The key of the configuration section.

Returns

IConfigurationSection

The IConfigurationSection.

Remarks

This method will never return null. If no matching sub-section is found with the specified key, an empty IConfigurationSection will be returned.

HandleChange()

Invoked by the base class when a change occurs.

protected virtual void HandleChange()

Events

OnChange

Invoked when this configuration file is updated.

public event Action<IConfiguration>? OnChange

Event Type

Action<IConfiguration>