Click or drag to resize

ConfigAccessorWriteFieldsIntoFile Method

Writes values of the annotated persistent fields into a file.

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 void WriteFieldsIntoFile(
	string filePath,
	Type type,
	Object instance,
	string rootNodePath = null,
	bool mergeMode = true,
	string group = ""
)
Request Example View Source

Parameters

filePath
Type: SystemString
A relative or an absolute path to the file. It's resolved via MakeAbsPathForGameData(String).
type
Type: SystemType
A type to write fields for.
instance
Type: SystemObject
An instance of type type. If it's null then only static fields will be written.
rootNodePath (Optional)
Type: SystemString
A path to the node in the file where the data should be written. If the node already exsists it will be deleted.
mergeMode (Optional)
Type: SystemBoolean
If true and the file already exists then only will be created.
group (Optional)
Type: SystemString
A group tag (see BasePersistentFieldAttribute).
Remarks
All persitent values are added into the file provided. I.e. if node had already had a value being persited then it either overwritten (ordinary fields) or extended (collection fields).
See Also