Represents a configuration file for the engine, providing functionality to create, load, and save engine settings.
More...
|
| string | FileName [get] |
| | Gets the name of the configuration file without the directory path.
|
| string | FilePath [get] |
| | Gets the full path to the configuration file.
|
| bool | AutoSave = false [get, set] |
| | Gets or sets a value indicating whether the configuration should be automatically saved when the instance is disposed.
|
| EngineConfiguration | EngineConfig = new() [get] |
| | Gets the engine configuration settings.
|
Represents a configuration file for the engine, providing functionality to create, load, and save engine settings.
This class manages the persistence of EngineConfiguration to and from a JSON file. It supports automatic saving on disposal and can be created from scratch or loaded from an existing file.
◆ CreateNew()
| EngineConfigurationFile Gondwana.Configuration.EngineConfigurationFile.CreateNew |
( |
string? | configFileName = null, |
|
|
bool? | autoSave = null ) |
|
static |
Creates a new engine configuration file with default settings.
- Parameters
-
| configFileName | The name of the configuration file to create. If null, uses the default file name "gondwana.json". |
| autoSave | A value indicating whether the configuration should be automatically saved when disposed. If null, defaults to false. |
- Returns
- A new EngineConfigurationFile instance with default engine configuration settings.
◆ Dispose()
| void Gondwana.Configuration.EngineConfigurationFile.Dispose |
( |
| ) |
|
◆ Load()
| EngineConfigurationFile Gondwana.Configuration.EngineConfigurationFile.Load |
( |
string? | configFileName = null, |
|
|
bool? | autoSave = null ) |
|
static |
Loads an engine configuration file from disk.
If the specified file does not exist or cannot be read, a new configuration with default settings is created. The configuration file is monitored for changes and will reload automatically when modified.
- Parameters
-
| configFileName | The name of the configuration file to load. If null, uses the default file name "gondwana.json". |
| autoSave | A value indicating whether the configuration should be automatically saved when disposed. If null, defaults to false. |
- Returns
- An EngineConfigurationFile instance loaded from the specified file, or a new instance with default settings if the file doesn't exist.
◆ Save() [1/2]
| void Gondwana.Configuration.EngineConfigurationFile.Save |
( |
| ) |
|
Saves the configuration to the file specified by FilePath.
The configuration is serialized to JSON with indented formatting for readability.
◆ Save() [2/2]
| void Gondwana.Configuration.EngineConfigurationFile.Save |
( |
string | jsonPath | ) |
|
Saves the configuration to the specified file path.
The configuration is serialized to JSON with indented formatting. After saving, the FileName property is updated to reflect the new path.
- Parameters
-
| jsonPath | The full path where the configuration file should be saved. |
◆ AutoSave
| bool Gondwana.Configuration.EngineConfigurationFile.AutoSave = false |
|
getset |
Gets or sets a value indicating whether the configuration should be automatically saved when the instance is disposed.
When set to true, the Save() method is automatically called during disposal.
◆ EngineConfig
Gets the engine configuration settings.
◆ FileName
| string Gondwana.Configuration.EngineConfigurationFile.FileName |
|
get |
Gets the name of the configuration file without the directory path.
◆ FilePath
| string Gondwana.Configuration.EngineConfigurationFile.FilePath |
|
get |
Gets the full path to the configuration file.