Class ExternalGlobalSettings
- Namespace
- MCM.Abstractions.Base.Global
- Assembly
- MCMv5.dll
Global settings declared in XML (SettingsXmlModel) instead of code.
MCM creates them for every <Settings> block found in the SubModule.xml of a loaded module,
so a mod gets a settings page without referencing MCM. The declaring file is also the store: saving writes
the current values back into it as Value attributes (SaveToFile()), where the mod reads them.
public sealed class ExternalGlobalSettings : FluentGlobalSettings, INotifyPropertyChanged, IFluentSettings
- Inheritance
-
ExternalGlobalSettings
- Implements
- Inherited Members
- Extension Methods
Fields
DeclarationFormatType
The format type of settings stored in their declaring XML file. No ISettingsFormat handles it, the container saves through SaveToFile().
public const string DeclarationFormatType = "xml-declaration"
Field Value
Properties
FilePath
The file the settings were declared in and are saved to: a standalone settings file or a module's SubModule.xml.
public string FilePath { get; init; }
Property Value
Methods
Create(SettingsXmlModel, string, PropertyChangedEventHandler?)
Builds the settings from a parsed model. Properties start at their current value, nested groups become
sub groups, the declared defaults become the default preset, and every <Preset> a built-in preset.
public static ExternalGlobalSettings Create(SettingsXmlModel model, string sourcePath, PropertyChangedEventHandler? propertyChanged = null)
Parameters
modelSettingsXmlModelsourcePathstringpropertyChangedPropertyChangedEventHandler
Returns
CreateDefaultValue(PropertyBaseXmlModel)
The declared default of the property, as the value object its reference takes.
public static object CreateDefaultValue(PropertyBaseXmlModel model)
Parameters
modelPropertyBaseXmlModel
Returns
CreateFromDocument(XmlDocument, string, PropertyChangedEventHandler?)
Reads every <Settings> block of a loaded document. sourcePath is kept as FilePath.
public static IEnumerable<ExternalGlobalSettings> CreateFromDocument(XmlDocument document, string sourcePath, PropertyChangedEventHandler? propertyChanged = null)
Parameters
documentXmlDocumentsourcePathstringpropertyChangedPropertyChangedEventHandler
Returns
CreateFromFile(string, PropertyChangedEventHandler?)
Reads every <Settings> block of an XML file. The file is either a standalone settings file
whose root is <Settings>, or a SubModule.xml whose <Module> root holds the blocks.
public static IEnumerable<ExternalGlobalSettings> CreateFromFile(string filePath, PropertyChangedEventHandler? propertyChanged = null)
Parameters
filePathstringpropertyChangedPropertyChangedEventHandler
Returns
CreateFromXml(XmlNode, string, PropertyChangedEventHandler?)
Reads one <Settings> element. Returns null when the element has no Id.
public static ExternalGlobalSettings? CreateFromXml(XmlNode settingsNode, string sourcePath, PropertyChangedEventHandler? propertyChanged = null)
Parameters
settingsNodeXmlNodesourcePathstringpropertyChangedPropertyChangedEventHandler
Returns
CreateFromXmlFile(string, PropertyChangedEventHandler?)
Reads the first <Settings> block of an XML file. See CreateFromFile(string, PropertyChangedEventHandler?).
public static ExternalGlobalSettings? CreateFromXmlFile(string filePath, PropertyChangedEventHandler? propertyChanged = null)
Parameters
filePathstringpropertyChangedPropertyChangedEventHandler
Returns
CreateReference(PropertyBaseXmlModel)
A reference holding the current value of the property. Its type decides the SettingType.
public static IRef CreateReference(PropertyBaseXmlModel model)
Parameters
modelPropertyBaseXmlModel
Returns
FormatValue(ISettingsPropertyDefinition)
The text a Value or Default attribute takes for the property's current value.
public static string FormatValue(ISettingsPropertyDefinition property)
Parameters
propertyISettingsPropertyDefinition
Returns
SaveToFile()
Writes the current values into FilePath as Value attributes. Returns false when the
file cannot be read or written or no longer holds the block; the values then live for this session only.
public bool SaveToFile()
Returns
TryParseValue(ISettingsPropertyDefinition, string, out object?)
Parses a value written the way a Default attribute is written. A dropdown takes the option index.
public static bool TryParseValue(ISettingsPropertyDefinition property, string raw, out object? value)
Parameters
propertyISettingsPropertyDefinitionrawstringvalueobject
Returns
This page was last modified at 10/17/2026 18:11:59 +03:00 (UTC).
Commit Message
Author: Vitalii Mikhailov
Commit: 4c11f9b0c8db5363fd147c4f156b8d8151ad53b0
* Mods can declare their settings in their SubModule.xml, which MCM will render if installed.
* A warning is logged when two mods declare settings with the same id
* Updated to UIExtenderEx v3
* Fixed controller tab switching in the options screen landing on the wrong page next to Mod Options
* Fixed Cancel in the options screen undoing MCM changes before the game ask...