Click or drag to resize

ConfigAccessor Class

A service class that simplifies accessing configuration files.
Inheritance Hierarchy
SystemObject
  KSPDev.ConfigUtilsConfigAccessor

Namespace:  KSPDev.ConfigUtils
Assembly:  KSPDev_Utils.1.1 (in KSPDev_Utils.1.1.dll) Version: 1.1 for KSP v1.6+
Syntax
C#
public static class ConfigAccessor
Request Example View Source

The ConfigAccessor type exposes the following members.

Methods
  NameDescription
Public methodStatic memberAddNodeByPath(ConfigNode, String, ConfigNode)
Adds a repeated node in the config by a path.
Public methodStatic memberAddNodeByPath(ConfigNode, String, ConfigNode)
Adds a repeated node in the config by a path.
Public methodStatic memberAddValueByPath(ConfigNode, String, String)
Adds a repeated value in config node by a path.
Public methodStatic memberAddValueByPath(ConfigNode, String, String)
Adds a repeated value in config node by a path.
Public methodStatic memberCode exampleCopyPartConfigFromPrefab
Copies the custom part fields from the prefab into the instance.
Public methodStatic memberGetNodeByPath(ConfigNode, String, Boolean)
Reads a node from config node by a path.
Public methodStatic memberGetNodeByPath(ConfigNode, String, Boolean)
Reads a node from config node by a path.
Public methodStatic memberGetNodesByPath(ConfigNode, String)
Reads repeated nodes from config node by a path.
Public methodStatic memberGetNodesByPath(ConfigNode, String)
Reads repeated nodes from config node by a path.
Public methodStatic memberGetValueByPath(ConfigNode, String)
Reads a value from config node by a path.
Public methodStatic memberGetValueByPath(ConfigNode, String)
Reads a value from config node by a path.
Public methodStatic memberGetValueByPathT(ConfigNode, String, AbstractOrdinaryValueTypeProto)
Reads a value of an arbitrary type T from the config node.
Public methodStatic memberGetValueByPathT(ConfigNode, String, AbstractOrdinaryValueTypeProto)
Reads a value of an arbitrary type T from the config node.
Public methodStatic memberGetValueByPathT(ConfigNode, String, T, AbstractOrdinaryValueTypeProto)
Reads a value of arbitrary type T from a config node.
Public methodStatic memberGetValueByPathT(ConfigNode, String, T, AbstractOrdinaryValueTypeProto)
Reads a value of arbitrary type T from a config node.
Public methodStatic memberGetValuesByPath(ConfigNode, String)
Reads repeated values from config node by a path.
Public methodStatic memberGetValuesByPath(ConfigNode, String)
Reads repeated values from config node by a path.
Public methodStatic memberReadFieldsFromDatabase
Reads values of the annotated persistent fields from a config file.
Public methodStatic memberReadFieldsFromFile
Reads values of the annotated persistent fields from a config file.
Public methodStatic memberReadFieldsFromNode
Reads the values of the annotated persistent fields from a config node.
Public methodStatic memberReadFieldsInType
Reads the persistent fields from the URI specified by the class annotation.
Public methodStatic memberCode exampleReadPartConfig
Reads custom type fileds from the part's config.
Public methodStatic memberSetNodeByPath(ConfigNode, String, ConfigNode)
Sets a node in config node by a path.
Public methodStatic memberSetNodeByPath(ConfigNode, String, ConfigNode)
Sets a node in config node by a path.
Public methodStatic memberSetValueByPath(ConfigNode, String, String)
Sets a value in config node by a path.
Public methodStatic memberSetValueByPath(ConfigNode, String, String)
Sets a value in config node by a path.
Public methodStatic memberSetValueByPathT(ConfigNode, String, T, AbstractOrdinaryValueTypeProto)
Stores a value of arbitrary type T into a config node.
Public methodStatic memberSetValueByPathT(ConfigNode, String, T, AbstractOrdinaryValueTypeProto)
Stores a value of arbitrary type T into a config node.
Public methodStatic memberStrToPath
Transforms a URL-like string path into the nodes path.
Public methodStatic memberWriteFieldsFromType
Writes persistent fields into the config files specified by the class annotation.
Public methodStatic memberWriteFieldsIntoFile
Writes values of the annotated persistent fields into a file.
Public methodStatic memberWriteFieldsIntoNode
Writes values of the annotated persistent fields into a config node.
Top
Remarks
This class provides a lot of useful methods to deal with values in game's configuration files. There are low level methods that deal with nodes and values, and there are high level methods that use metadata from the annotated fields.
See Also