Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | List of all members
KSP.IO.PluginConfiguration Class Reference

Acts as a proxy between plugins and the filesystem so plugins can't go and mess with stuff outside of KSP's install dir. Saves as an XML file in PluginData/assemblyname[/flightname]/config.xml. More...

Public Member Functions

GetValue< T > (string key)
 Get a typed value from the root node. More...
 
GetValue< T > (string key, T _default)
 Get a typed value from the root node, and set to a default if it doesn't exist. More...
 
void load ()
 Load from disk More...
 
void save ()
 Commit changes to disk More...
 
void SetValue (string key, object value)
 Set a configuration key's value More...
 

Static Public Member Functions

static PluginConfiguration CreateForType< T > (Vessel flight=null)
 Initialize the configuration object More...
 

Protected Member Functions

 PluginConfiguration (string pathToFile)
 Don't use this, use Create. More...
 

Properties

Object this[string key] [get, set]
 Return configuration key from the root node. More...
 

Detailed Description

Acts as a proxy between plugins and the filesystem so plugins can't go and mess with stuff outside of KSP's install dir. Saves as an XML file in PluginData/assemblyname[/flightname]/config.xml.

Constructor & Destructor Documentation

KSP.IO.PluginConfiguration.PluginConfiguration ( string  pathToFile)
inlineprotected

Don't use this, use Create.

Parameters
pathToFile

Member Function Documentation

static PluginConfiguration KSP.IO.PluginConfiguration.CreateForType< T > ( Vessel  flight = null)
inlinestatic

Initialize the configuration object

Template Parameters
TThe plugin type for which it is being initialized
Parameters
flightOptional flight
Returns
returns a PluginConfiguration object
T KSP.IO.PluginConfiguration.GetValue< T > ( string  key)
inline

Get a typed value from the root node.

Template Parameters
TThe type you want
Parameters
keyThe key you want to access
Returns
The value you wanted, or null if the key didn't exist.
T KSP.IO.PluginConfiguration.GetValue< T > ( string  key,
_default 
)
inline

Get a typed value from the root node, and set to a default if it doesn't exist.

Template Parameters
TThe type you want
Parameters
keyThe key you want to access
_defaultThe default value, if the key doesn't exist in the map
Returns
The value you wanted, or the default if the key didn't exist.
void KSP.IO.PluginConfiguration.load ( )
inline

Load from disk

void KSP.IO.PluginConfiguration.save ( )
inline

Commit changes to disk

void KSP.IO.PluginConfiguration.SetValue ( string  key,
object  value 
)
inline

Set a configuration key's value

Parameters
keyThe key's name
valueA value

Property Documentation

Object KSP.IO.PluginConfiguration.this[string key]
getset

Return configuration key from the root node.

Parameters
keyThe configuration key's name
Returns
The value desired

The documentation for this class was generated from the following file: